root/library/tests/loggers_test.cpp @ 493

Revision 493, 0.9 kB (checked in by vbarta, 15 years ago)

fixed UIREGISTER

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