|
Revision 470, 0.9 kB
(checked in by vbarta, 16 years ago)
|
|
fixed fixes for Windows for Linux
|
-
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 | |
|---|
| 10 | using namespace bdm; |
|---|
| 11 | |
|---|
| 12 | TEST(test_dirfilelog) |
|---|
| 13 | { |
|---|
| 14 | RV th = RV("{alog blog }"); |
|---|
| 15 | RV r = RV("{r }", "2"); |
|---|
| 16 | |
|---|
| 17 | string ls("exp"); |
|---|
| 18 | remove_all(ls.c_str()); |
|---|
| 19 | makedir(ls, false); |
|---|
| 20 | remove_all("exp/dirfile"); |
|---|
| 21 | |
|---|
| 22 | dirfilelog L("exp/dirfile", 10); |
|---|
| 23 | |
|---|
| 24 | int rid; |
|---|
| 25 | int thid; |
|---|
| 26 | |
|---|
| 27 | rid = L.add(r, ""); |
|---|
| 28 | thid = L.add(th, "th"); |
|---|
| 29 | |
|---|
| 30 | L.init(); |
|---|
| 31 | |
|---|
| 32 | for (int i = 0; i < 150; i++) { |
|---|
| 33 | L.logit(rid, vec_2((double)i, (double)(i + 1))); |
|---|
| 34 | L.logit(thid, vec_2((double)(100 - i), (double)(i - 50))); |
|---|
| 35 | L.step(); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | L.finalize(); |
|---|
| 39 | |
|---|
| 40 | std::string expected(load_test_file("dirfile-format.matrix")); |
|---|
| 41 | std::string actual(load_test_file("exp/dirfile/format")); |
|---|
| 42 | CHECK_EQUAL(expected, actual); |
|---|
| 43 | } |
|---|