[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 83c84c5 4/5: Test calling write_tsv() in unit
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 83c84c5 4/5: Test calling write_tsv() in unit test |
Date: |
Sat, 6 Oct 2018 16:59:47 -0400 (EDT) |
branch: master
commit 83c84c58701d5fbe786cd918f22aa0deca03e6f0
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Test calling write_tsv() in unit test
---
ledger.hpp | 2 ++
ledger_test.cpp | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/ledger.hpp b/ledger.hpp
index babe88e..478b728 100644
--- a/ledger.hpp
+++ b/ledger.hpp
@@ -62,6 +62,8 @@ class ledger_map_holder;
class LMI_SO Ledger
{
+ friend class ledger_test;
+
public:
explicit Ledger
(int length
diff --git a/ledger_test.cpp b/ledger_test.cpp
index af7790a..4618591 100644
--- a/ledger_test.cpp
+++ b/ledger_test.cpp
@@ -22,11 +22,15 @@
#include "pchfile.hpp"
#include "ledger.hpp"
+#include "ledger_evaluator.hpp"
#include "ledger_invariant.hpp"
#include "ledger_variant.hpp"
+#include "path_utility.hpp" // initialize_filesystem()
#include "test_tools.hpp"
+#include <cstdio> // remove()
+
void authenticate_system() {} // Do-nothing stub.
class ledger_test
@@ -63,11 +67,18 @@ void ledger_test::test_default_initialization()
void ledger_test::test_evaluator()
{
Ledger ledger(100, mce_finra, false, false, false);
- ledger.make_evaluator();
+ ledger.ledger_invariant_->WriteTsvFile = true;
+ ledger_evaluator z {ledger.make_evaluator()};
+ z.write_tsv("tsv_eraseme");
+ BOOST_TEST(0 == std::remove("tsv_eraseme.values.tsv"));
}
int test_main(int, char*[])
{
+ // Absolute paths require "native" name-checking policy for msw.
+ initialize_filesystem();
+
ledger_test::test();
+
return EXIT_SUCCESS;
}