root/library/tests/loggers_test.cpp @ 477

Revision 477, 0.9 kB (checked in by mido, 15 years ago)

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

  • Property svn:eol-style set to native
Line 
1#define BDMLIB // not an ideal way to prevent double registration of UI factories...
2#include "base/loggers.h"
3#include "test_util.h"
4#include "osutils.h"
5#include "UnitTest++.h"
6#include <string>
7#include <sys/stat.h>
8#include <sys/types.h>
9
10using namespace bdm;
11
12TEST ( test_dirfilelog ) {
13        RV th = RV ( "{alog blog }" );
14        RV r = RV ( "{r }", "2" );
15
16        string ls ( "exp" );
17        remove_all ( ls.c_str() );
18        makedir ( ls, false );
19        remove_all ( "exp/dirfile" );
20
21        dirfilelog L ( "exp/dirfile", 10 );
22
23        int rid;
24        int thid;
25
26        rid = L.add ( r, "" );
27        thid = L.add ( th, "th" );
28
29        L.init();
30
31        for ( int i = 0; i < 150; i++ ) {
32                L.logit ( rid, vec_2 ( ( double ) i, ( double ) ( i + 1 ) ) );
33                L.logit ( thid, vec_2 ( ( double ) ( 100 - i ), ( double ) ( i - 50 ) ) );
34                L.step();
35        }
36
37        L.finalize();
38
39        std::string expected ( load_test_file ( "dirfile-format.matrix" ) );
40        std::string actual ( load_test_file ( "exp/dirfile/format" ) );
41        CHECK_EQUAL ( expected, actual );
42}
Note: See TracBrowser for help on using the browser.