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
RevLine 
[425]1#define BDMLIB // not an ideal way to prevent double registration of UI factories...
[386]2#include "base/loggers.h"
[425]3#include "test_util.h"
[469]4#include "osutils.h"
[425]5#include "UnitTest++.h"
6#include <string>
7#include <sys/stat.h>
8#include <sys/types.h>
[87]9
[254]10using namespace bdm;
[87]11
[477]12TEST ( test_dirfilelog ) {
13        RV th = RV ( "{alog blog }" );
14        RV r = RV ( "{r }", "2" );
[87]15
[477]16        string ls ( "exp" );
17        remove_all ( ls.c_str() );
18        makedir ( ls, false );
19        remove_all ( "exp/dirfile" );
[87]20
[477]21        dirfilelog L ( "exp/dirfile", 10 );
[425]22
[477]23        int rid;
24        int thid;
[425]25
[477]26        rid = L.add ( r, "" );
27        thid = L.add ( th, "th" );
[425]28
[477]29        L.init();
[425]30
[477]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        }
[425]36
[477]37        L.finalize();
[425]38
[477]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 );
[87]42}
Note: See TracBrowser for help on using the browser.