From: <jgr...@us...> - 2003-03-25 05:25:03
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1:/tmp/cvs-serv20897/tests Modified Files: TestBayes.tst Log Message: Make the UI pluggable; make SMTP, NNTP and POP3 modules register and handle their own configuration UI; factor the HTTP code out of the UI and into own class; implement XML-RPC interface; make test suite allow selection of tests to run; change the way POPFile reports its startup; make the version string work Index: TestBayes.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestBayes.tst,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestBayes.tst 20 Feb 2003 21:36:42 -0000 1.4 --- TestBayes.tst 25 Mar 2003 05:24:58 -0000 1.5 *************** *** 13,29 **** my $c = new POPFile::Configuration; my $b = new Classifier::Bayes; ! $b->{configuration} = $c; $b->initialize(); ! $b->{configuration}->{configuration}{corpus} = 'tests/corpus'; $b->start(); # getting and setting values ! test_assert_equal( $b->get_value( 'personal', 'foo' ), log(1/103) ); ! $b->{total}{personal} = 100; ! $b->set_value( 'personal', 'foo', 100 ); ! test_assert_equal( $b->get_value( 'personal', 'foo' ), 0 ); ! $b->{total}{personal} = 1000; ! $b->set_value( 'personal', 'foo', 100 ); ! test_assert_equal( $b->get_value( 'personal', 'foo' ), -log(10) ); # glob the tests directory for files called TestMailParse\d+.msg which consist of messages --- 13,35 ---- my $c = new POPFile::Configuration; my $b = new Classifier::Bayes; ! $b->configuration( $c ); $b->initialize(); ! $b->config_( 'corpus', 'tests/corpus' ); $b->start(); # getting and setting values ! test_assert_equal( $b->get_value_( 'personal', 'foo' ), log(1/103) ); ! $b->{total__}{personal} = 100; ! $b->set_value_( 'personal', 'foo', 100 ); ! test_assert_equal( $b->get_value_( 'personal', 'foo' ), 0 ); ! $b->{total__}{personal} = 1000; ! $b->set_value_( 'personal', 'foo', 100 ); ! test_assert_equal( $b->get_value_( 'personal', 'foo' ), -log(10) ); ! ! # test the API functions ! my @buckets = $b->get_buckets(); ! test_assert_equal( $buckets[0], '' ); ! test_assert_equal( $buckets[1], '' ); ! test_assert_equal( $buckets[2], '' ); # glob the tests directory for files called TestMailParse\d+.msg which consist of messages *************** *** 49,59 **** # to be sent through classify_and_modify ! $b->{configuration}->{configuration}{msgdir} = 'tests/'; ! $b->{configuration}->{configuration}{ui_port} = '8080'; ! $b->{configuration}->{configuration}{xtc} = 1; ! $b->{configuration}->{configuration}{xpl} = 1; ! $b->{configuration}->{configuration}{localpop} = 1; ! $b->{configuration}->{configuration}{subject} = 1; ! $b->{parameters}{spam}{subject} = 1; my @modify_tests = sort glob 'tests/TestMailParse*.msg'; --- 55,65 ---- # to be sent through classify_and_modify ! $b->config_( 'msgdir', 'tests/' ); ! $b->module_config_( 'html', 'port', 8080 ); ! $b->config_( 'xtc', 1 ); ! $b->config_( 'xpl', 1 ); ! $b->module_config_( 'pop3', 'local', 1 ); ! $b->module_config_( 'subject', 1 ); ! $b->set_bucket_parameter( 'spam', 'subject', 1 ); my @modify_tests = sort glob 'tests/TestMailParse*.msg'; *************** *** 82,86 **** unlink( 'tests/popfile0=0.msg' ); unlink( 'tests/popfile0=0.cls' ); - # rename( 'tests/temp.out', $output_file ); unlink( 'tests/temp.out' ); } --- 88,91 ---- |