[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5281a36 3/3: Rename unit-test macros
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5281a36 3/3: Rename unit-test macros |
Date: |
Wed, 3 Mar 2021 08:01:58 -0500 (EST) |
branch: master
commit 5281a36ac3793de170164a54a2cea4833d3376eb
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename unit-test macros
---
actuarial_table_test.cpp | 106 ++++----
alert_test.cpp | 6 +-
any_member_test.cpp | 200 +++++++-------
assert_lmi_test.cpp | 6 +-
authenticity_test.cpp | 112 ++++----
bourn_cast_test.cpp | 232 ++++++++--------
cache_file_reads_test.cpp | 4 +-
calendar_date_test.cpp | 594 ++++++++++++++++++++--------------------
callback_test.cpp | 2 +-
comma_punct_test.cpp | 2 +-
commutation_functions_test.cpp | 16 +-
configurable_settings_test.cpp | 12 +-
contains_test.cpp | 32 +--
crc32_test.cpp | 2 +-
currency_test.cpp | 126 ++++-----
dbo_rules_test.cpp | 52 ++--
dbvalue.cpp | 2 +-
et_vector_0_test.cpp | 22 +-
expression_template_0_test.cpp | 20 +-
fenv_lmi_test.cpp | 126 ++++-----
file_command_test.cpp | 2 +-
financial_test.cpp | 112 ++++----
getopt_test.cpp | 6 +-
global_settings_test.cpp | 16 +-
gpt_test.cpp | 26 +-
handle_exceptions_test.cpp | 6 +-
ieee754_test.cpp | 42 +--
input_sequence_test.cpp | 66 ++---
input_test.cpp | 130 ++++-----
interpolate_string_test.cpp | 76 +++---
irc7702_tables_test.cpp | 16 +-
irc7702a_test.cpp | 14 +-
istream_to_string_test.cpp | 16 +-
ledger_test.cpp | 20 +-
loads_test.cpp | 146 +++++-----
map_lookup_test.cpp | 4 +-
materially_equal_test.cpp | 148 +++++-----
math_functions_test.cpp | 130 ++++-----
mc_enum_test.cpp | 104 +++----
md5sum_test.cpp | 38 +--
miscellany_test.cpp | 276 +++++++++----------
monnaie_test.cpp | 80 +++---
mortality_rates_test.cpp | 12 +-
name_value_pairs_test.cpp | 44 +--
ncnnnpnn_test.cpp | 156 +++++------
numeric_io_test.cpp | 214 +++++++--------
path_utility_test.cpp | 142 +++++-----
premium_tax_test.cpp | 60 ++--
product_file_test.cpp | 34 +--
progress_meter_test.cpp | 26 +-
rate_table_test.cpp | 98 +++----
regex_test.cpp | 134 ++++-----
report_table_test.cpp | 168 ++++++------
round_test.cpp | 14 +-
round_to_test.cpp | 40 +--
rtti_lmi_test.cpp | 12 +-
safely_dereference_as_test.cpp | 12 +-
snprintf_test.cpp | 42 +--
ssize_lmi_test.cpp | 20 +-
stratified_algorithms_test.cpp | 246 ++++++++---------
stream_cast_test.cpp | 52 ++--
system_command_test.cpp | 4 +-
test_main.cpp | 2 +-
test_tools.hpp | 46 ++--
test_tools_test.cpp | 45 ++-
timer_test.cpp | 16 +-
tn_range_test.cpp | 278 +++++++++----------
value_cast_test.cpp | 602 ++++++++++++++++++++---------------------
vector_test.cpp | 36 +--
xml_serialize_test.cpp | 28 +-
zero_test.cpp | 46 ++--
71 files changed, 2888 insertions(+), 2889 deletions(-)
diff --git a/actuarial_table_test.cpp b/actuarial_table_test.cpp
index b236c4a..f76d41e 100644
--- a/actuarial_table_test.cpp
+++ b/actuarial_table_test.cpp
@@ -221,7 +221,7 @@ void test_80cso_erratum
actuarial_table const a(qx_cso, table_number);
// No smoker-nonsmoker distinction below age 15.
std::vector<double> v1 = a.values(15, 85);
- BOOST_TEST(v0 == v1);
+ LMI_TEST(v0 == v1);
}
} // Unnamed namespace.
@@ -251,13 +251,13 @@ void assay_speed()
void test_precondition_failures()
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table("nonexistent", 0)
,std::runtime_error
,"There is no table number 0 in file 'nonexistent'."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table("nonexistent", 1)
,std::runtime_error
,"File 'nonexistent.ndx' is required but could not be found."
@@ -268,16 +268,16 @@ void test_precondition_failures()
std::ofstream ofs("eraseme.ndx", ios_out_trunc_binary());
ofs << ifs.rdbuf();
ofs.close();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table("eraseme", 1)
,std::runtime_error
,"File 'eraseme.dat' is required but could not be found."
" Try reinstalling."
);
- BOOST_TEST(0 == std::remove("eraseme.ndx"));
+ LMI_TEST(0 == std::remove("eraseme.ndx"));
actuarial_table z(qx_ins, 256);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(z.values_elaborated(80, 42, e_reenter_never, 0, 0)
,std::runtime_error
,"Cannot use 'e_reenter_never' here."
@@ -295,31 +295,31 @@ void test_lookup_errors()
// 0 minimum age
// 99 maximum age
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table(qx_cso, 42).values( 0, -1)
,std::runtime_error
,"Assertion '0 <= length && length <= 1 + max_age_ - issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table(qx_cso, 42).values( 0, 101)
,std::runtime_error
,"Assertion '0 <= length && length <= 1 + max_age_ - issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table(qx_cso, 42).values( 1, 100)
,std::runtime_error
,"Assertion '0 <= length && length <= 1 + max_age_ - issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table(qx_cso, 42).values( -1, 10)
,std::runtime_error
,"Assertion 'min_age_ <= issue_age && issue_age <= max_age_' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(actuarial_table(qx_cso, 42).values(100, 1)
,std::runtime_error
,"Assertion 'min_age_ <= issue_age && issue_age <= max_age_' failed."
@@ -332,54 +332,54 @@ void test_e_reenter_never()
std::vector<double> gauge;
rates = actuarial_table(qx_ins, 750).values(1, 15);
- BOOST_TEST(rates == table_750());
+ LMI_TEST(rates == table_750());
rates = actuarial_table(qx_cso, 42).values( 0, 100);
- BOOST_TEST(rates == table_42(0));
+ LMI_TEST(rates == table_42(0));
rates = actuarial_table(qx_cso, 42).values(35, 65);
- BOOST_TEST(rates == table_42(35));
+ LMI_TEST(rates == table_42(35));
rates = actuarial_table(qx_ins, 256).values(10, 112);
gauge = table_256(10, 0);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
rates = actuarial_table(qx_ins, 256).values(80, 42);
gauge = table_256(80, 0);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
// Issue age exceeds maximum select age. Arguably, this ought to
// signal an error; however, this behavior is reasonable, and the
// 'e_reenter_at_inforce_duration' implementation relies on it.
rates = actuarial_table(qx_ins, 256).values(81, 41);
- BOOST_TEST_EQUAL(rates[0], 0.10486); // [81]+0 --> [80]+1
- BOOST_TEST_EQUAL(rates[1], 0.13557); // [81]+1 --> [80]+2
- BOOST_TEST_EQUAL(rates[2], 0.16221); // [81]+2 --> 83 ultimate
+ LMI_TEST_EQUAL(rates[0], 0.10486); // [81]+0 --> [80]+1
+ LMI_TEST_EQUAL(rates[1], 0.13557); // [81]+1 --> [80]+2
+ LMI_TEST_EQUAL(rates[2], 0.16221); // [81]+2 --> 83 ultimate
gauge = table_256(80, 0);
gauge.erase(gauge.begin(), 1 + gauge.begin());
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
gauge = table_256(80, 1);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
rates = actuarial_table(qx_ins, 256).values(82, 40);
- BOOST_TEST_EQUAL(rates[0], 0.13557); // [82]+0 --> [80]+2
- BOOST_TEST_EQUAL(rates[1], 0.16221); // [82]+1 --> 83 ultimate
+ LMI_TEST_EQUAL(rates[0], 0.13557); // [82]+0 --> [80]+2
+ LMI_TEST_EQUAL(rates[1], 0.16221); // [82]+1 --> 83 ultimate
gauge = table_256(80, 2);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
rates = actuarial_table(qx_ins, 256).values(83, 39);
- BOOST_TEST_EQUAL(rates[0], 0.16221); // [83]+0 --> 83 ultimate
- BOOST_TEST_EQUAL(rates[1], 0.17425); // [83]+1 --> 84 ultimate
+ LMI_TEST_EQUAL(rates[0], 0.16221); // [83]+0 --> 83 ultimate
+ LMI_TEST_EQUAL(rates[1], 0.17425); // [83]+1 --> 84 ultimate
gauge = table_256(80, 3);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
rates = actuarial_table(qx_ins, 256).values(84, 38);
- BOOST_TEST_EQUAL(rates[0], 0.17425); // [84]+0 --> 84 ultimate
+ LMI_TEST_EQUAL(rates[0], 0.17425); // [84]+0 --> 84 ultimate
gauge = table_256(80, 0);
gauge.erase(gauge.begin(), 4 + gauge.begin());
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
}
void test_e_reenter_at_inforce_duration()
@@ -411,7 +411,7 @@ void test_e_reenter_at_inforce_duration()
rates = table.values_elaborated(iss_age, length, m, pol_dur,
reset_dur);
gauge = table_256(iss_age + pol_dur, 0);
gauge.insert(gauge.begin(), pol_dur, 0.0);
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
}
// Once age has been set ahead to maximum, can't push it farther.
@@ -421,27 +421,27 @@ void test_e_reenter_at_inforce_duration()
rates = table.values_elaborated(iss_age, length, m, pol_dur, reset_dur);
gauge = table_256(iss_age, 0);
gauge[0] = 0.0;
- BOOST_TEST(rates == gauge);
+ LMI_TEST(rates == gauge);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age - 1, 1, m, 0, 0)
,std::runtime_error
,"Assertion 'min_age_ <= issue_age && issue_age <= max_age_' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age, 1, m, -1, 0)
,std::runtime_error
,"Assertion '0 <= inforce_duration' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age, 1, m, 999, 0)
,std::runtime_error
,"Assertion 'inforce_duration < 1 + max_age_ - issue_age' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age - 999, 1000, m, 999, 0)
,std::runtime_error
,"Assertion 'min_age_ <= issue_age && issue_age <= max_age_' failed."
@@ -481,18 +481,18 @@ void test_e_reenter_upon_rate_reset()
rates = table.values_elaborated(iss_age, length, m, pol_dur,
reset_dur);
gauge0 = table_256(effective_age, 0);
gauge0.erase(gauge0.begin(), gauge0.begin() - reset_dur);
- BOOST_TEST(rates == gauge0);
+ LMI_TEST(rates == gauge0);
gauge1 = table.values(effective_age, 1 + max_age - effective_age);
gauge1.erase(gauge1.begin(), gauge1.begin() - reset_dur);
- BOOST_TEST(rates == gauge1);
+ LMI_TEST(rates == gauge1);
}
// Once age has been set back to minimum, can't push it farther.
- BOOST_TEST(iss_age - select_period < min_age);
+ LMI_TEST(iss_age - select_period < min_age);
reset_dur = -select_period;
rates = table.values_elaborated(iss_age, length, m, pol_dur, reset_dur);
- BOOST_TEST(rates == gauge0);
- BOOST_TEST(rates == gauge1);
+ LMI_TEST(rates == gauge0);
+ LMI_TEST(rates == gauge1);
// A group's reset date can precede a new entrant's birthdate, so
// the age-setback argument as such isn't limited. The algorithm
@@ -500,8 +500,8 @@ void test_e_reenter_upon_rate_reset()
// table's minimum age.
reset_dur = -999;
rates = table.values_elaborated(iss_age, length, m, pol_dur, reset_dur);
- BOOST_TEST(rates == gauge0);
- BOOST_TEST(rates == gauge1);
+ LMI_TEST(rates == gauge0);
+ LMI_TEST(rates == gauge1);
// Positive reset duration (reset date follows contract date):
// age is in effect set forward.
@@ -513,10 +513,10 @@ void test_e_reenter_upon_rate_reset()
rates = table.values_elaborated(iss_age, length, m, pol_dur,
reset_dur);
gauge0 = table_256(effective_age, 0);
gauge0.insert(gauge0.begin(), reset_dur, 0.0);
- BOOST_TEST(rates == gauge0);
+ LMI_TEST(rates == gauge0);
gauge1 = table.values(effective_age, 1 + max_age - effective_age);
gauge1.insert(gauge1.begin(), reset_dur, 0.0);
- BOOST_TEST(rates == gauge1);
+ LMI_TEST(rates == gauge1);
}
// 'e_reenter_upon_rate_reset' and 'e_reenter_at_inforce_duration'
@@ -542,15 +542,15 @@ void test_e_reenter_upon_rate_reset()
,reset_dur
);
rates1.erase(rates1.begin(), rates1.begin() + pol_dur);
- BOOST_TEST(rates0 == rates1);
+ LMI_TEST(rates0 == rates1);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age, 1, m, 0, 999)
,std::runtime_error
,"Assertion 'reset_duration <= inforce_duration' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table.values_elaborated(min_age - 1, 1, m, 0, 0)
,std::runtime_error
,"Assertion 'min_age_ <= issue_age && issue_age <= max_age_' failed."
@@ -561,7 +561,7 @@ void test_e_reenter_upon_rate_reset()
// must be accepted.
rates = table.values_elaborated(min_age, 1 + max_age - min_age, m, 0,
-999);
gauge0 = table_256(min_age, 0);
- BOOST_TEST(rates == gauge0);
+ LMI_TEST(rates == gauge0);
}
/// The e_actuarial_table_method variants are designed for use with
@@ -574,7 +574,7 @@ void test_exotic_lookup_methods_with_attained_age_table()
std::vector<double> rates;
rates = table42.values(0, 100);
- BOOST_TEST(rates == table_42(0));
+ LMI_TEST(rates == table_42(0));
rates = table42.values_elaborated
(0
@@ -583,7 +583,7 @@ void test_exotic_lookup_methods_with_attained_age_table()
,99 // inforce_duration
,0 // reset_duration
);
- BOOST_TEST(rates == table_42(0));
+ LMI_TEST(rates == table_42(0));
rates = table42.values_elaborated
(0
@@ -592,7 +592,7 @@ void test_exotic_lookup_methods_with_attained_age_table()
,0 // inforce_duration
,-999 // reset_duration
);
- BOOST_TEST(rates == table_42(0));
+ LMI_TEST(rates == table_42(0));
rates = table42.values_elaborated
(0
@@ -601,9 +601,9 @@ void test_exotic_lookup_methods_with_attained_age_table()
,99 // inforce_duration
,99 // reset_duration
);
- BOOST_TEST(rates == table_42(0));
+ LMI_TEST(rates == table_42(0));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table42.values_elaborated
(0
,100
diff --git a/alert_test.cpp b/alert_test.cpp
index 0eefb65..69639fa 100644
--- a/alert_test.cpp
+++ b/alert_test.cpp
@@ -80,17 +80,17 @@ int test_main(int, char*[])
// probably in std::ios_base::clear().
std::string s("First simulated alarum.");
- BOOST_TEST_THROW(alarum() << s << std::flush, std::runtime_error, s);
+ LMI_TEST_THROW(alarum() << s << std::flush, std::runtime_error, s);
s = "Second simulated alarum.";
- BOOST_TEST_THROW(alarum() << s << std::flush, std::runtime_error, s);
+ LMI_TEST_THROW(alarum() << s << std::flush, std::runtime_error, s);
// The CLI handler should gobble this message.
test_stream_arg(status(), "This should not be printed.");
test_stream_arg(warning(), "This message should appear on stdout.");
- BOOST_TEST_THROW(test_stream_arg(alarum(), "X"), std::runtime_error, "X");
+ LMI_TEST_THROW(test_stream_arg(alarum(), "X"), std::runtime_error, "X");
return 0;
}
diff --git a/any_member_test.cpp b/any_member_test.cpp
index 2072b16..8ec0ddc 100644
--- a/any_member_test.cpp
+++ b/any_member_test.cpp
@@ -238,113 +238,113 @@ void any_member_test::test_any_member()
{
S s;
s["i0"] = "999";
- BOOST_TEST_EQUAL(s.i0, 999);
+ LMI_TEST_EQUAL(s.i0, 999);
s["i0"] = "077"; // Interpreted as decimal, not as octal.
- BOOST_TEST_EQUAL(s.i0, 77);
+ LMI_TEST_EQUAL(s.i0, 77);
s["i0"] = "09"; // Valid decimal, not invalid octal.
- BOOST_TEST_EQUAL(s.i0, 9);
+ LMI_TEST_EQUAL(s.i0, 9);
s["i1"] = "888000";
- BOOST_TEST_EQUAL(s.i1, 888000);
+ LMI_TEST_EQUAL(s.i1, 888000);
// s["i0"] = "999.9"; // Invalid integer-literal.
// s["i1"] = "888e3"; // Invalid integer-literal.
s["d0"] = "777";
- BOOST_TEST_EQUAL(s.d0, 777);
+ LMI_TEST_EQUAL(s.d0, 777);
s["d0"] = "777.";
- BOOST_TEST_EQUAL(s.d0, 777);
+ LMI_TEST_EQUAL(s.d0, 777);
s["d0"] = "777E3";
- BOOST_TEST_EQUAL(s.d0, 777000);
+ LMI_TEST_EQUAL(s.d0, 777000);
s["d0"] = ".777E3";
- BOOST_TEST_EQUAL(s.d0, 777);
+ LMI_TEST_EQUAL(s.d0, 777);
s["s0"] = "hello";
- BOOST_TEST_EQUAL(s.s0, "hello");
+ LMI_TEST_EQUAL(s.s0, "hello");
std::stringstream ss;
s.write(ss);
- BOOST_TEST_EQUAL(ss.str(), "9 888000 777 hello");
+ LMI_TEST_EQUAL(ss.str(), "9 888000 777 hello");
// Test const operator[]().
S const s_const;
- BOOST_TEST_EQUAL("0", s_const["i0"].str());
+ LMI_TEST_EQUAL("0", s_const["i0"].str());
// Test operator==() and operator!=().
// operator==(): same objects, same members.
- BOOST_TEST(s_const["i0"] == s_const["i0"]);
- BOOST_TEST(s_const["d0"] == s_const["d0"]);
- BOOST_TEST(s_const["s0"] == s_const["s0"]);
- BOOST_TEST(s_const["x0"] == s_const["x0"]);
+ LMI_TEST(s_const["i0"] == s_const["i0"]);
+ LMI_TEST(s_const["d0"] == s_const["d0"]);
+ LMI_TEST(s_const["s0"] == s_const["s0"]);
+ LMI_TEST(s_const["x0"] == s_const["x0"]);
// operator!=(): different objects.
- BOOST_TEST(s["i0"] != s_const["i0"]);
- BOOST_TEST(s["i1"] != s_const["i0"]);
+ LMI_TEST(s["i0"] != s_const["i0"]);
+ LMI_TEST(s["i1"] != s_const["i0"]);
// operator==(): different members of same type.
- BOOST_TEST(s_const["i0"] == s_const["i1"]);
+ LMI_TEST(s_const["i0"] == s_const["i1"]);
- BOOST_TEST(s["i0"] != s["i1"]);
+ LMI_TEST(s["i0"] != s["i1"]);
s["i0"] = s["i1"];
- BOOST_TEST(s["i0"] == s["i1"]);
+ LMI_TEST(s["i0"] == s["i1"]);
s["i0"] = s_const["i0"];
s["i1"] = s_const["i0"];
- BOOST_TEST(s["i0"] == s["i1"]);
+ LMI_TEST(s["i0"] == s["i1"]);
// operator==(): different objects, same member.
- BOOST_TEST(s["i0"] == s_const["i0"]);
+ LMI_TEST(s["i0"] == s_const["i0"]);
// operator==(): different objects, different members of same type.
- BOOST_TEST(s["i1"] == s_const["i0"]);
+ LMI_TEST(s["i1"] == s_const["i0"]);
// operator==(): different objects, different member types.
- BOOST_TEST(s_const["x0"] != s["i0"]);
- BOOST_TEST(s_const["x0"] != s["d0"]);
- BOOST_TEST(s_const["x0"] != s["s0"]);
+ LMI_TEST(s_const["x0"] != s["i0"]);
+ LMI_TEST(s_const["x0"] != s["d0"]);
+ LMI_TEST(s_const["x0"] != s["s0"]);
// operator==(): same object, different member types.
- BOOST_TEST(s_const["x0"] != s_const["i0"]);
+ LMI_TEST(s_const["x0"] != s_const["i0"]);
// Make sure distinct object identity is preserved by assignment.
s["i1"] = "909090";
- BOOST_TEST(s["i1"] != s_const["i1"]);
+ LMI_TEST(s["i1"] != s_const["i1"]);
s["i1"] = s_const["i1"];
- BOOST_TEST(s["i1"] == s_const["i1"]);
+ LMI_TEST(s["i1"] == s_const["i1"]);
s["i1"] = "909090";
- BOOST_TEST(s["i1"] != s_const["i1"]);
+ LMI_TEST(s["i1"] != s_const["i1"]);
s["i0"] = s["i1"];
- BOOST_TEST(s["i0"] == s["i1"]);
+ LMI_TEST(s["i0"] == s["i1"]);
s["i1"] = "9";
- BOOST_TEST(s["i0"] != s["i1"]);
+ LMI_TEST(s["i0"] != s["i1"]);
// Test MemberSymbolTable::equals().
- BOOST_TEST(s_const == s_const);
- BOOST_TEST(s_const != s );
- BOOST_TEST(s == s );
+ LMI_TEST(s_const == s_const);
+ LMI_TEST(s_const != s );
+ LMI_TEST(s == s );
// Test MemberSymbolTable::assign().
s.MemberSymbolTable<S>::assign(s_const);
- BOOST_TEST(s_const == s );
+ LMI_TEST(s_const == s );
// Test no-such-member diagnostic for both const and non-const
// subscripting operators.
@@ -353,8 +353,8 @@ void any_member_test::test_any_member()
err += lmi::TypeInfo(typeid(S)).Name();
err += " ascribes no member named 'nonexistent'.";
- BOOST_TEST_THROW(s_const["nonexistent"], std::runtime_error, err);
- BOOST_TEST_THROW(s ["nonexistent"], std::runtime_error, err);
+ LMI_TEST_THROW(s_const["nonexistent"], std::runtime_error, err);
+ LMI_TEST_THROW(s ["nonexistent"], std::runtime_error, err);
// Make sure numeric_io_cast is used for writing arithmetic types
// to std::string, for any compiler that has IEC 60559 doubles and
@@ -362,8 +362,8 @@ void any_member_test::test_any_member()
s.d0 = std::exp(1.0);
double d1 = *s["d0"].exact_cast<double>();
- BOOST_TEST_EQUAL(numeric_io_cast<std::string>(d1), "2.718281828459045");
- BOOST_TEST_EQUAL(s["d0"].str(), "2.718281828459045");
+ LMI_TEST_EQUAL(numeric_io_cast<std::string>(d1), "2.718281828459045");
+ LMI_TEST_EQUAL(s["d0"].str(), "2.718281828459045");
// COMPILER !! The borland compiler can build the program with the
// following line, but a run-time exception results.
@@ -458,25 +458,25 @@ void any_member_test::supplemental_test0()
err += lmi::TypeInfo(typeid(base_datum)).Name();
err += "'.";
- BOOST_TEST_THROW(member_cast<base_datum>(s["i0"]), std::runtime_error,
err);
+ LMI_TEST_THROW(member_cast<base_datum>(s["i0"]), std::runtime_error, err);
base_datum* bp1 = member_cast<base_datum>(s["dd"]);
- BOOST_TEST_EQUAL(1729, bp1->virtual_function());
+ LMI_TEST_EQUAL(1729, bp1->virtual_function());
// This is appropriately forbidden: virtual_function() is not const.
// base_datum const* bp2 = member_cast<base_datum>(s["dd"]);
-// BOOST_TEST_EQUAL(1729, bp2->virtual_function());
+// LMI_TEST_EQUAL(1729, bp2->virtual_function());
// COMPILER !! The borland compiler doesn't find the const overload;
// presumably it is defective in this respect.
S const& r = s;
base_datum const* bp3 = member_cast<base_datum>(r["dd"]);
- BOOST_TEST_EQUAL(7, bp3->sane);
+ LMI_TEST_EQUAL(7, bp3->sane);
// This is appropriately forbidden: virtual_function() is not const.
-// BOOST_TEST_EQUAL(1729, bp3->virtual_function());
+// LMI_TEST_EQUAL(1729, bp3->virtual_function());
// If the original type is known, an explicit exact_cast is possible.
- BOOST_TEST_EQUAL(1729,
s["dd"].exact_cast<derived_datum>()->virtual_function());
+ LMI_TEST_EQUAL(1729,
s["dd"].exact_cast<derived_datum>()->virtual_function());
// If the original type isn't precisely unknown, but is known to
// derive from a particular base class, then function template
@@ -484,17 +484,17 @@ void any_member_test::supplemental_test0()
// type and safely return a pointer to the base class, provided
// that it has sufficient knowledge of the inheritance hierarchy.
// This obviates writing the type of the member pointed to.
- BOOST_TEST_EQUAL(1729,
member_cast<base_datum>(s["dd"])->virtual_function());
+ LMI_TEST_EQUAL(1729, member_cast<base_datum>(s["dd"])->virtual_function());
// Of course, member_cast() should work with the exact type, too.
- BOOST_TEST_EQUAL(1729,
member_cast<derived_datum>(s["dd"])->virtual_function());
+ LMI_TEST_EQUAL(1729,
member_cast<derived_datum>(s["dd"])->virtual_function());
// Function template is_reconstitutable_as() ascertains whether
// the unknown original type is derived from a given base class.
- BOOST_TEST(is_reconstitutable_as<base_datum>(s["dd"]));
+ LMI_TEST(is_reconstitutable_as<base_datum>(s["dd"]));
// is_reconstitutable_as() should not work with the exact type.
- BOOST_TEST(!is_reconstitutable_as<derived_datum>(s["dd"]));
+ LMI_TEST(!is_reconstitutable_as<derived_datum>(s["dd"]));
}
{
@@ -538,20 +538,20 @@ void any_member_test::supplemental_test0()
void any_member_test::supplemental_test1()
{
T r0;
- BOOST_TEST_EQUAL(0 , r0.i0);
- BOOST_TEST_EQUAL(0 , r0.i1);
- BOOST_TEST_EQUAL(0.0, r0.d0);
- BOOST_TEST_EQUAL("" , r0.s0);
+ LMI_TEST_EQUAL(0 , r0.i0);
+ LMI_TEST_EQUAL(0 , r0.i1);
+ LMI_TEST_EQUAL(0.0, r0.d0);
+ LMI_TEST_EQUAL("" , r0.s0);
// Test writing through a pointer to member.
int T::*x = &T::i0;
r0.*x = 5;
- BOOST_TEST_EQUAL(5 , r0.i0);
- BOOST_TEST_EQUAL(0 , r0.i1);
- BOOST_TEST_EQUAL(0.0, r0.d0);
+ LMI_TEST_EQUAL(5 , r0.i0);
+ LMI_TEST_EQUAL(0 , r0.i1);
+ LMI_TEST_EQUAL(0.0, r0.d0);
double T::*y = &T::d0;
r0.*y = 3.14159;
- BOOST_TEST_EQUAL(3.14159, r0.d0);
+ LMI_TEST_EQUAL(3.14159, r0.d0);
// Test writing through the map of ascribed member names.
r0["i0"] = "999";
@@ -559,75 +559,75 @@ void any_member_test::supplemental_test1()
r0["d0"] = "777";
r0["q0"] = "8.125";
r0["s0"] = "hello";
- BOOST_TEST_EQUAL(999 , r0.i0);
- BOOST_TEST_EQUAL(888000 , r0.i1);
- BOOST_TEST_EQUAL(777.0 , r0.d0);
- BOOST_TEST_EQUAL(8.125f , r0.q0);
- BOOST_TEST_EQUAL("hello", r0.s0);
+ LMI_TEST_EQUAL(999 , r0.i0);
+ LMI_TEST_EQUAL(888000 , r0.i1);
+ LMI_TEST_EQUAL(777.0 , r0.d0);
+ LMI_TEST_EQUAL(8.125f , r0.q0);
+ LMI_TEST_EQUAL("hello", r0.s0);
T r1;
r1["i0"] = "135";
r1["i1"] = "246";
r1["d0"] = "888";
r1["s0"] = "world";
- BOOST_TEST_EQUAL(135 , r1.i0);
- BOOST_TEST_EQUAL(246 , r1.i1);
- BOOST_TEST_EQUAL(888.0 , r1.d0);
- BOOST_TEST_EQUAL("world", r1.s0);
+ LMI_TEST_EQUAL(135 , r1.i0);
+ LMI_TEST_EQUAL(246 , r1.i1);
+ LMI_TEST_EQUAL(888.0 , r1.d0);
+ LMI_TEST_EQUAL("world", r1.s0);
// Make sure that didn't affect the other instance of class T.
- BOOST_TEST_EQUAL(999 , r0.i0);
- BOOST_TEST_EQUAL(888e3 , r0.i1);
- BOOST_TEST_EQUAL(777.0 , r0.d0);
- BOOST_TEST_EQUAL("hello", r0.s0);
+ LMI_TEST_EQUAL(999 , r0.i0);
+ LMI_TEST_EQUAL(888e3 , r0.i1);
+ LMI_TEST_EQUAL(777.0 , r0.d0);
+ LMI_TEST_EQUAL("hello", r0.s0);
r0["i0"] = "1234567";
- BOOST_TEST_EQUAL(1234567, r0.i0);
- BOOST_TEST_EQUAL(888e3 , r0.i1);
- BOOST_TEST_EQUAL(777.0 , r0.d0);
- BOOST_TEST_EQUAL("hello", r0.s0);
+ LMI_TEST_EQUAL(1234567, r0.i0);
+ LMI_TEST_EQUAL(888e3 , r0.i1);
+ LMI_TEST_EQUAL(777.0 , r0.d0);
+ LMI_TEST_EQUAL("hello", r0.s0);
// Make sure that didn't affect the other instance of class T.
- BOOST_TEST_EQUAL(135 , r1.i0);
- BOOST_TEST_EQUAL(246 , r1.i1);
- BOOST_TEST_EQUAL(888.0 , r1.d0);
- BOOST_TEST_EQUAL("world", r1.s0);
+ LMI_TEST_EQUAL(135 , r1.i0);
+ LMI_TEST_EQUAL(246 , r1.i1);
+ LMI_TEST_EQUAL(888.0 , r1.d0);
+ LMI_TEST_EQUAL("world", r1.s0);
// Works for base class Q too.
T r2;
- BOOST_TEST_EQUAL(0.0f, r2.q0);
+ LMI_TEST_EQUAL(0.0f, r2.q0);
r2["q0"] = "123.456";
- BOOST_TEST_EQUAL(123.456f, r2.q0);
+ LMI_TEST_EQUAL(123.456f, r2.q0);
// Test equality operator.
- BOOST_TEST( r1["i0"] == r1["i0"]);
- BOOST_TEST( r1["i0"] != r0["i0"]);
- BOOST_TEST(!(r1["i0"] == r0["i0"]));
+ LMI_TEST( r1["i0"] == r1["i0"]);
+ LMI_TEST( r1["i0"] != r0["i0"]);
+ LMI_TEST(!(r1["i0"] == r0["i0"]));
- BOOST_TEST( r1["d0"] == r1["d0"]);
- BOOST_TEST( r1["d0"] != r0["d0"]);
- BOOST_TEST(!(r1["d0"] == r0["d0"]));
+ LMI_TEST( r1["d0"] == r1["d0"]);
+ LMI_TEST( r1["d0"] != r0["d0"]);
+ LMI_TEST(!(r1["d0"] == r0["d0"]));
r1["d0"] = r0["d0"];
- BOOST_TEST( r1["d0"] == r1["d0"]);
- BOOST_TEST( r1["d0"] == r0["d0"]);
- BOOST_TEST(!(r1["d0"] != r0["d0"]));
+ LMI_TEST( r1["d0"] == r1["d0"]);
+ LMI_TEST( r1["d0"] == r0["d0"]);
+ LMI_TEST(!(r1["d0"] != r0["d0"]));
// Test equality operator with empty strings--we once observed
// a problem in that case.
r1["s0"] = "";
- BOOST_TEST( r1["s0"] == r1["s0"]);
- BOOST_TEST( r1["s0"] != r0["s0"]);
- BOOST_TEST(!(r1["s0"] != r1["s0"]));
- BOOST_TEST(!(r1["s0"] == r0["s0"]));
+ LMI_TEST( r1["s0"] == r1["s0"]);
+ LMI_TEST( r1["s0"] != r0["s0"]);
+ LMI_TEST(!(r1["s0"] != r1["s0"]));
+ LMI_TEST(!(r1["s0"] == r0["s0"]));
- BOOST_TEST_THROW(r2["unknown_member"], std::runtime_error, "");
+ LMI_TEST_THROW(r2["unknown_member"], std::runtime_error, "");
// Assigning a decimal-literal value to an integer isn't type
// safe, and might require truncation, so it's forbidden.
- BOOST_TEST_THROW(r2["i0"] = "888e3", std::invalid_argument, "");
- BOOST_TEST_THROW(r2["i1"] = "999.9", std::invalid_argument, "");
+ LMI_TEST_THROW(r2["i0"] = "888e3", std::invalid_argument, "");
+ LMI_TEST_THROW(r2["i1"] = "999.9", std::invalid_argument, "");
}
// This test detects a problem with the original distribution of
@@ -650,7 +650,7 @@ struct R : public Bar<R>
void any_member_test::como_433_test()
{
R s;
- BOOST_TEST_EQUAL(&(s.c), &(s.*&R::c)); // Succeeds.
- BOOST_TEST_EQUAL(&(s.i), &(s.*&R::i)); // Succeeds.
- BOOST_TEST_EQUAL(&(s.d), &(s.*&R::d)); // Fails with original como.
+ LMI_TEST_EQUAL(&(s.c), &(s.*&R::c)); // Succeeds.
+ LMI_TEST_EQUAL(&(s.i), &(s.*&R::i)); // Succeeds.
+ LMI_TEST_EQUAL(&(s.d), &(s.*&R::d)); // Fails with original como.
}
diff --git a/assert_lmi_test.cpp b/assert_lmi_test.cpp
index 0adb374..7238377 100644
--- a/assert_lmi_test.cpp
+++ b/assert_lmi_test.cpp
@@ -30,7 +30,7 @@ int test_main(int, char*[])
LMI_ASSERT(true);
bool const volatile not_true = false;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(LMI_ASSERT(not_true)
,std::runtime_error
,"Assertion 'not_true' failed."
@@ -45,13 +45,13 @@ int test_main(int, char*[])
// This use-case demonstrates why LMI_ASSERT_WITH_MSG's second
// parameter is not token-pasted.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(LMI_ASSERT_WITH_MSG(not_true,"<" << not_true << ">")
,std::runtime_error
,"Assertion 'not_true' failed\n(<0>)."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(LMI_ASSERT_EQUAL(not_true,true)
,std::runtime_error
,"Assertion '(not_true) == (true)' failed\n(expected 1 vs observed 0)."
diff --git a/authenticity_test.cpp b/authenticity_test.cpp
index fd15a3a..9e4fdfc 100644
--- a/authenticity_test.cpp
+++ b/authenticity_test.cpp
@@ -130,7 +130,7 @@ void PasskeyTest::RemoveTestFiles(char const* file, int
line) const
for(auto const& i : filenames)
{
std::remove(i.c_str());
- INVOKE_BOOST_TEST(!fs::exists(i), file, line);
+ INVOKE_LMI_TEST(!fs::exists(i), file, line);
}
}
@@ -159,13 +159,13 @@ void PasskeyTest::InitializeDataFile() const
;
std::ofstream os("coleridge", ios_out_trunc_binary());
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os << rime;
os.close();
unsigned char sum[md5len];
md5_buffer(rime, std::strlen(rime), sum);
- BOOST_TEST_EQUAL("bf039dbb0e8061971a2c322c8336199c", md5_str(sum));
+ LMI_TEST_EQUAL("bf039dbb0e8061971a2c322c8336199c", md5_str(sum));
}
/// Write a data file to be passed to the 'lmi_md5sum' program.
@@ -188,10 +188,10 @@ void PasskeyTest::InitializeMd5sumFile() const
std::FILE* in = std::fopen("coleridge", "rb");
md5_stream(in, sum);
std::fclose(in);
- BOOST_TEST_EQUAL("bf039dbb0e8061971a2c322c8336199c", md5_str(sum));
+ LMI_TEST_EQUAL("bf039dbb0e8061971a2c322c8336199c", md5_str(sum));
std::ofstream os(md5sum_file(), ios_out_trunc_binary());
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os << md5_hex_string(std::vector<unsigned char>(sum, sum + md5len));
os << " coleridge\n";
os.close();
@@ -211,21 +211,21 @@ void PasskeyTest::InitializePasskeyFile() const
md5_stream(md5, sum);
std::fclose(md5);
- BOOST_TEST_EQUAL("efb7a0a972b88bb5b9ac6f60390d61bf", md5_str(sum));
+ LMI_TEST_EQUAL("efb7a0a972b88bb5b9ac6f60390d61bf", md5_str(sum));
char c_passkey[md5len];
unsigned char u_passkey[md5len];
std::memcpy(c_passkey, sum, md5len);
- BOOST_TEST_EQUAL("efb7a0a972b88bb5b9ac6f60390d61bf", md5_str(c_passkey));
+ LMI_TEST_EQUAL("efb7a0a972b88bb5b9ac6f60390d61bf", md5_str(c_passkey));
md5_buffer(c_passkey, md5len, u_passkey);
- BOOST_TEST_EQUAL("8a4829bf31de9437c95aedaeead398d7", md5_str(u_passkey));
+ LMI_TEST_EQUAL("8a4829bf31de9437c95aedaeead398d7", md5_str(u_passkey));
std::memcpy(c_passkey, u_passkey, md5len);
- BOOST_TEST_EQUAL("8a4829bf31de9437c95aedaeead398d7", md5_str(c_passkey));
+ LMI_TEST_EQUAL("8a4829bf31de9437c95aedaeead398d7", md5_str(c_passkey));
md5_buffer(c_passkey, md5len, u_passkey);
- BOOST_TEST_EQUAL("3ff4953dbddf009634922fa52a342bfe", md5_str(u_passkey));
+ LMI_TEST_EQUAL("3ff4953dbddf009634922fa52a342bfe", md5_str(u_passkey));
std::ofstream os("passkey", ios_out_trunc_binary());
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os << md5_hex_string
(std::vector<unsigned char>(u_passkey, u_passkey + md5len)
);
@@ -234,7 +234,7 @@ void PasskeyTest::InitializePasskeyFile() const
void PasskeyTest::InitializeExpiryFile() const
{
std::ofstream os("expiry");
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os << BeginDate_ << ' ' << EndDate_;
os.close();
}
@@ -255,7 +255,7 @@ void PasskeyTest::InitializeExpiryFile() const
void PasskeyTest::CheckNominal(char const* file, int line) const
{
Authenticity::ResetCache();
- INVOKE_BOOST_TEST_EQUAL
+ INVOKE_LMI_TEST_EQUAL
("validated"
,Authenticity::Assay(BeginDate_, Pwd_)
,file
@@ -294,14 +294,14 @@ void PasskeyTest::TestFromAfar() const
std::string const tmp = "/tmp/" + fs::basename(__FILE__);
fs::path const remote_dir_0(fs::complete(tmp));
fs::create_directory(remote_dir_0);
- BOOST_TEST(fs::exists(remote_dir_0) && fs::is_directory(remote_dir_0));
- BOOST_TEST_EQUAL(0, chdir(remote_dir_0.string().c_str()));
- BOOST_TEST_EQUAL(remote_dir_0.string(), fs::current_path().string());
+ LMI_TEST(fs::exists(remote_dir_0) && fs::is_directory(remote_dir_0));
+ LMI_TEST_EQUAL(0, chdir(remote_dir_0.string().c_str()));
+ LMI_TEST_EQUAL(remote_dir_0.string(), fs::current_path().string());
Authenticity::ResetCache();
- BOOST_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
- BOOST_TEST_EQUAL(remote_dir_0.string(), fs::current_path().string());
- BOOST_TEST_EQUAL(0, chdir(Pwd_.string().c_str()));
- BOOST_TEST_EQUAL(Pwd_.string(), fs::current_path().string());
+ LMI_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
+ LMI_TEST_EQUAL(remote_dir_0.string(), fs::current_path().string());
+ LMI_TEST_EQUAL(0, chdir(Pwd_.string().c_str()));
+ LMI_TEST_EQUAL(Pwd_.string(), fs::current_path().string());
fs::remove(remote_dir_0);
#if defined LMI_MSW
@@ -315,26 +315,26 @@ void PasskeyTest::TestFromAfar() const
try
{
- BOOST_TEST(fs::is_directory(remote_dir_1));
+ LMI_TEST(fs::is_directory(remote_dir_1));
}
catch(std::exception const& e)
{
std::string s(e.what());
if(contains(s, "boost::filesystem::is_directory"))
{
- BOOST_TEST(false);
+ LMI_TEST(false);
goto done;
}
throw;
}
- BOOST_TEST_EQUAL(0, chdir(remote_dir_1.string().c_str()));
- BOOST_TEST_EQUAL(remote_dir_1.string(), fs::current_path().string());
+ LMI_TEST_EQUAL(0, chdir(remote_dir_1.string().c_str()));
+ LMI_TEST_EQUAL(remote_dir_1.string(), fs::current_path().string());
Authenticity::ResetCache();
- BOOST_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
- BOOST_TEST_EQUAL(remote_dir_1.string(), fs::current_path().string());
- BOOST_TEST_EQUAL(0, chdir(Pwd_.string().c_str()));
- BOOST_TEST_EQUAL(Pwd_.string(), fs::current_path().string());
+ LMI_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
+ LMI_TEST_EQUAL(remote_dir_1.string(), fs::current_path().string());
+ LMI_TEST_EQUAL(0, chdir(Pwd_.string().c_str()));
+ LMI_TEST_EQUAL(Pwd_.string(), fs::current_path().string());
done:
#endif // defined LMI_MSW
@@ -353,34 +353,34 @@ void PasskeyTest::TestDate() const
CheckNominal(__FILE__, __LINE__);
Authenticity::ResetCache();
- BOOST_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
- BOOST_TEST_EQUAL("cached" , Authenticity::Assay(BeginDate_, Pwd_));
+ LMI_TEST_EQUAL("validated", Authenticity::Assay(BeginDate_, Pwd_));
+ LMI_TEST_EQUAL("cached" , Authenticity::Assay(BeginDate_, Pwd_));
calendar_date const last_date = EndDate_ - 1;
- BOOST_TEST_EQUAL("validated", Authenticity::Assay(last_date, Pwd_));
- BOOST_TEST_EQUAL("cached" , Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST_EQUAL("validated", Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST_EQUAL("cached" , Authenticity::Assay(last_date, Pwd_));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Current date 2000-12-31 is invalid:"
" this system cannot be used before 2001-01-01."
" Contact the home office."
,Authenticity::Assay(BeginDate_ - 1, Pwd_)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Current date 2001-01-03 is invalid:"
" this system cannot be used after 2001-01-02."
" Contact the home office."
,Authenticity::Assay(EndDate_, Pwd_)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Current date 2001-01-13 is invalid:"
" this system cannot be used after 2001-01-02."
" Contact the home office."
,Authenticity::Assay(EndDate_ + 10, Pwd_)
);
- BOOST_TEST_UNEQUAL("cached", Authenticity::Assay(last_date, Pwd_));
- BOOST_TEST_EQUAL ("cached", Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST_UNEQUAL("cached", Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST_EQUAL ("cached", Authenticity::Assay(last_date, Pwd_));
CheckNominal(__FILE__, __LINE__);
}
@@ -398,34 +398,34 @@ void PasskeyTest::TestPasskey() const
CheckNominal(__FILE__, __LINE__);
calendar_date const last_date = EndDate_ - 1;
- BOOST_TEST_EQUAL("validated", Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST_EQUAL("validated", Authenticity::Assay(last_date, Pwd_));
std::ofstream os0("passkey", ios_out_trunc_binary());
- BOOST_TEST(os0.good());
+ LMI_TEST(os0.good());
std::vector<unsigned char> const wrong(md5len);
os0 << md5_hex_string(wrong);
os0.close();
- BOOST_TEST_EQUAL("cached" , Authenticity::Assay(last_date, Pwd_));
- BOOST_TEST(last_date != BeginDate_);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL("cached" , Authenticity::Assay(last_date, Pwd_));
+ LMI_TEST(last_date != BeginDate_);
+ LMI_TEST_EQUAL
("Passkey is incorrect for this version. Contact the home office."
,Authenticity::Assay(BeginDate_, Pwd_)
);
std::remove("passkey");
- BOOST_TEST(!fs::exists("passkey"));
+ LMI_TEST(!fs::exists("passkey"));
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Unable to read passkey file 'passkey'. Try reinstalling."
,Authenticity::Assay(BeginDate_, ".")
);
std::ofstream os1("passkey", ios_out_trunc_binary());
os1 << "wrong";
- BOOST_TEST(os1.good());
+ LMI_TEST(os1.good());
os1.close();
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Length of passkey 'wrong' is 5 but should be 32. Try reinstalling."
,Authenticity::Assay(BeginDate_, Pwd_)
);
@@ -439,7 +439,7 @@ void PasskeyTest::TestDataFile() const
CheckNominal(__FILE__, __LINE__);
std::ofstream os("coleridge", ios_out_trunc_binary());
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os << "This file has the wrong md5sum.";
os.close();
@@ -450,7 +450,7 @@ void PasskeyTest::TestDataFile() const
<< "\nto print:"
<< std::endl
;
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("At least one required file is missing, altered, or invalid."
" Try reinstalling."
,Authenticity::Assay(BeginDate_, Pwd_)
@@ -465,19 +465,19 @@ void PasskeyTest::TestExpiry() const
CheckNominal(__FILE__, __LINE__);
std::remove("expiry");
- BOOST_TEST(!fs::exists("expiry"));
+ LMI_TEST(!fs::exists("expiry"));
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Unable to read expiry file 'expiry'. Try reinstalling."
,Authenticity::Assay(BeginDate_, ".")
);
{
std::ofstream os("expiry");
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os.close();
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Error reading expiry file 'expiry'. Try reinstalling."
,Authenticity::Assay(BeginDate_, ".")
);
@@ -486,10 +486,10 @@ void PasskeyTest::TestExpiry() const
{
std::ofstream os("expiry");
os << "2400000";
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os.close();
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Error reading expiry file 'expiry'. Try reinstalling."
,Authenticity::Assay(BeginDate_, ".")
);
@@ -498,10 +498,10 @@ void PasskeyTest::TestExpiry() const
{
std::ofstream os("expiry");
os << "bogus dates";
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os.close();
Authenticity::ResetCache();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Error reading expiry file 'expiry'. Try reinstalling."
,Authenticity::Assay(BeginDate_, ".")
);
diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 2320665..32c8e60 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -64,14 +64,14 @@ void test_same(char const* file, int line)
using traits = std::numeric_limits<T>;
T upper = traits::max();
T lower = traits::lowest();
- INVOKE_BOOST_TEST(upper == bourn_cast<T>(upper), file, line);
- INVOKE_BOOST_TEST(T( 1) == bourn_cast<T>(T( 1)), file, line);
- INVOKE_BOOST_TEST(T( 0) == bourn_cast<T>(T( 0)), file, line);
- INVOKE_BOOST_TEST(lower == bourn_cast<T>(lower), file, line);
+ INVOKE_LMI_TEST(upper == bourn_cast<T>(upper), file, line);
+ INVOKE_LMI_TEST(T( 1) == bourn_cast<T>(T( 1)), file, line);
+ INVOKE_LMI_TEST(T( 0) == bourn_cast<T>(T( 0)), file, line);
+ INVOKE_LMI_TEST(lower == bourn_cast<T>(lower), file, line);
if(traits::is_signed)
{
- INVOKE_BOOST_TEST(T(-1) == bourn_cast<T>(T(-1)), file, line);
+ INVOKE_LMI_TEST(T(-1) == bourn_cast<T>(T(-1)), file, line);
}
// Test whether integer limits are correctly calculated by this
@@ -86,12 +86,12 @@ void test_same(char const* file, int line)
long double const x = std::scalbln(1.0l, traits::digits);
long double const max = x - 1;
long double const min = traits::is_signed ? -x : 0;
- INVOKE_BOOST_TEST(traits::max() == max, file, line);
- INVOKE_BOOST_TEST(traits::min() == min, file, line);
+ INVOKE_LMI_TEST(traits::max() == max, file, line);
+ INVOKE_LMI_TEST(traits::min() == min, file, line);
T imax = bourn_cast<T>(max);
T imin = bourn_cast<T>(min);
- INVOKE_BOOST_TEST(traits::max() == imax, file, line);
- INVOKE_BOOST_TEST(traits::min() == imin, file, line);
+ INVOKE_LMI_TEST(traits::max() == imax, file, line);
+ INVOKE_LMI_TEST(traits::min() == imin, file, line);
}
}
@@ -133,32 +133,32 @@ void test_signednesses(char const* file, int line)
// SCHAR_MAX must be at least 127, so 99 must be representable.
// Both char.
- INVOKE_BOOST_TEST_EQUAL(CTo( 0), bourn_cast<CTo>(CFrom( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo( 1), bourn_cast<CTo>(CFrom( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo(99), bourn_cast<CTo>(CFrom(99)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo_max, bourn_cast<CTo>(CFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo( 0), bourn_cast<CTo>(CFrom( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo( 1), bourn_cast<CTo>(CFrom( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(99), bourn_cast<CTo>(CFrom(99)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_max, bourn_cast<CTo>(CFrom_max), file, line);
// Both int.
- INVOKE_BOOST_TEST_EQUAL(ITo( 0), bourn_cast<ITo>(IFrom( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo( 1), bourn_cast<ITo>(IFrom( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo(99), bourn_cast<ITo>(IFrom(99)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo_max, bourn_cast<ITo>(IFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo( 0), bourn_cast<ITo>(IFrom( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo( 1), bourn_cast<ITo>(IFrom( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo(99), bourn_cast<ITo>(IFrom(99)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo_max, bourn_cast<ITo>(IFrom_max), file, line);
// Both long long.
- INVOKE_BOOST_TEST_EQUAL(LTo( 0), bourn_cast<LTo>(LFrom( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(LTo( 1), bourn_cast<LTo>(LFrom( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(LTo(99), bourn_cast<LTo>(LFrom(99)), file, line);
- INVOKE_BOOST_TEST_EQUAL(LTo_max, bourn_cast<LTo>(LFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo( 0), bourn_cast<LTo>(LFrom( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo( 1), bourn_cast<LTo>(LFrom( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo(99), bourn_cast<LTo>(LFrom(99)), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo_max, bourn_cast<LTo>(LFrom_max), file, line);
// To wider than From.
- INVOKE_BOOST_TEST_EQUAL(CTo_max, bourn_cast<ITo>(CFrom_max), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo_max, bourn_cast<ITo>(CFrom_max), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo_max, bourn_cast<LTo>(IFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_max, bourn_cast<ITo>(CFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_max, bourn_cast<ITo>(CFrom_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo_max, bourn_cast<LTo>(IFrom_max), file, line);
// From wider than To.
- INVOKE_BOOST_TEST_EQUAL(CTo( 0), bourn_cast<CTo>(IFrom( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo( 1), bourn_cast<CTo>(LFrom( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo(99), bourn_cast<CTo>(LFrom(99)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo( 0), bourn_cast<CTo>(IFrom( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo( 1), bourn_cast<CTo>(LFrom( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(99), bourn_cast<CTo>(LFrom(99)), file, line);
if(!SignedFrom || !SignedTo) return;
@@ -173,29 +173,29 @@ void test_signednesses(char const* file, int line)
// SCHAR_MIN must be <= -127, so -9 must be representable.
// Both char.
- INVOKE_BOOST_TEST_EQUAL(CTo(-1), bourn_cast<CTo>(CFrom(-1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(CFrom(-9)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo_min, bourn_cast<CTo>(CFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(-1), bourn_cast<CTo>(CFrom(-1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(CFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_min, bourn_cast<CTo>(CFrom_min), file, line);
// Both int.
- INVOKE_BOOST_TEST_EQUAL(ITo(-1), bourn_cast<ITo>(IFrom(-1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo(-9), bourn_cast<ITo>(IFrom(-9)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo_min, bourn_cast<ITo>(IFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo(-1), bourn_cast<ITo>(IFrom(-1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo(-9), bourn_cast<ITo>(IFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo_min, bourn_cast<ITo>(IFrom_min), file, line);
// Both long long.
- INVOKE_BOOST_TEST_EQUAL(LTo(-1), bourn_cast<LTo>(LFrom(-1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(LTo(-9), bourn_cast<LTo>(LFrom(-9)), file, line);
- INVOKE_BOOST_TEST_EQUAL(LTo_min, bourn_cast<LTo>(LFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo(-1), bourn_cast<LTo>(LFrom(-1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo(-9), bourn_cast<LTo>(LFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(LTo_min, bourn_cast<LTo>(LFrom_min), file, line);
// To wider than From.
- INVOKE_BOOST_TEST_EQUAL(CTo_min, bourn_cast<ITo>(CFrom_min), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo_min, bourn_cast<ITo>(CFrom_min), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo_min, bourn_cast<LTo>(IFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_min, bourn_cast<ITo>(CFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo_min, bourn_cast<ITo>(CFrom_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo_min, bourn_cast<LTo>(IFrom_min), file, line);
// From wider than To.
- INVOKE_BOOST_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(IFrom(-9)), file, line);
- INVOKE_BOOST_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(LFrom(-9)), file, line);
- INVOKE_BOOST_TEST_EQUAL(ITo(-9), bourn_cast<ITo>(LFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(IFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(CTo(-9), bourn_cast<CTo>(LFrom(-9)), file, line);
+ INVOKE_LMI_TEST_EQUAL(ITo(-9), bourn_cast<ITo>(LFrom(-9)), file, line);
}
/// Test floating-point conversions [conv.double].
@@ -219,8 +219,8 @@ void test_floating_conversions(char const* file, int line)
From const largenum = nonstd::power(From(2), 100);
From const smallnum = From(1) / largenum;
- INVOKE_BOOST_TEST_EQUAL(largenum, bourn_cast<To>(largenum), file, line);
- INVOKE_BOOST_TEST_EQUAL(smallnum, bourn_cast<To>(smallnum), file, line);
+ INVOKE_LMI_TEST_EQUAL(largenum, bourn_cast<To>(largenum), file, line);
+ INVOKE_LMI_TEST_EQUAL(smallnum, bourn_cast<To>(smallnum), file, line);
// Normal min, max, and lowest.
@@ -230,19 +230,19 @@ void test_floating_conversions(char const* file, int line)
if(from_traits::digits10 <= to_traits::digits10) // Widening or same.
{
- INVOKE_BOOST_TEST_EQUAL(from_min, bourn_cast<To>(from_min), file,
line);
- INVOKE_BOOST_TEST_EQUAL(from_max, bourn_cast<To>(from_max), file,
line);
- INVOKE_BOOST_TEST_EQUAL(from_low, bourn_cast<To>(from_low), file,
line);
+ INVOKE_LMI_TEST_EQUAL(from_min, bourn_cast<To>(from_min), file, line);
+ INVOKE_LMI_TEST_EQUAL(from_max, bourn_cast<To>(from_max), file, line);
+ INVOKE_LMI_TEST_EQUAL(from_low, bourn_cast<To>(from_low), file, line);
}
else // Narrowing.
{
- INVOKE_BOOST_TEST_EQUAL(To(0), bourn_cast<To>(from_min), file, line);
- BOOST_TEST_THROW
+ INVOKE_LMI_TEST_EQUAL(To(0), bourn_cast<To>(from_min), file, line);
+ LMI_TEST_THROW
(bourn_cast<To>(from_max)
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<To>(from_low)
,std::runtime_error
,"Cast would transgress lower limit."
@@ -251,22 +251,22 @@ void test_floating_conversions(char const* file, int line)
// Signed zeros.
- INVOKE_BOOST_TEST_EQUAL(0.0, bourn_cast<To>( From(0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(0.0, bourn_cast<To>(-From(0)), file, line);
- INVOKE_BOOST_TEST(!std::signbit(bourn_cast<To>( From(0))), file, line);
- INVOKE_BOOST_TEST( std::signbit(bourn_cast<To>(-From(0))), file, line);
+ INVOKE_LMI_TEST_EQUAL(0.0, bourn_cast<To>( From(0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(0.0, bourn_cast<To>(-From(0)), file, line);
+ INVOKE_LMI_TEST(!std::signbit(bourn_cast<To>( From(0))), file, line);
+ INVOKE_LMI_TEST( std::signbit(bourn_cast<To>(-From(0))), file, line);
// Infinities.
To const to_inf = to_traits::infinity();
From const from_inf = from_traits::infinity();
#if !defined TEST_BOOST_CAST_INSTEAD
- INVOKE_BOOST_TEST( std::isinf(bourn_cast<To>( from_inf)), file, line);
- INVOKE_BOOST_TEST( std::isinf(bourn_cast<To>(-from_inf)), file, line);
- INVOKE_BOOST_TEST(!std::signbit(bourn_cast<To>( from_inf)), file, line);
- INVOKE_BOOST_TEST( std::signbit(bourn_cast<To>(-from_inf)), file, line);
- INVOKE_BOOST_TEST_EQUAL( to_inf, bourn_cast<To>( from_inf), file, line);
- INVOKE_BOOST_TEST_EQUAL(-to_inf, bourn_cast<To>(-from_inf), file, line);
+ INVOKE_LMI_TEST( std::isinf(bourn_cast<To>( from_inf)), file, line);
+ INVOKE_LMI_TEST( std::isinf(bourn_cast<To>(-from_inf)), file, line);
+ INVOKE_LMI_TEST(!std::signbit(bourn_cast<To>( from_inf)), file, line);
+ INVOKE_LMI_TEST( std::signbit(bourn_cast<To>(-from_inf)), file, line);
+ INVOKE_LMI_TEST_EQUAL( to_inf, bourn_cast<To>( from_inf), file, line);
+ INVOKE_LMI_TEST_EQUAL(-to_inf, bourn_cast<To>(-from_inf), file, line);
#else // defined TEST_BOOST_CAST_INSTEAD
// Boost allows conversion of infinities to the same type or a
// wider floating type, but not to a narrower type--presumably
@@ -275,17 +275,17 @@ void test_floating_conversions(char const* file, int line)
// of value.
if(from_traits::digits10 <= to_traits::digits10) // Widening or same.
{
- INVOKE_BOOST_TEST_EQUAL( to_inf, bourn_cast<To>( from_inf), file,
line);
- INVOKE_BOOST_TEST_EQUAL(-to_inf, bourn_cast<To>(-from_inf), file,
line);
+ INVOKE_LMI_TEST_EQUAL( to_inf, bourn_cast<To>( from_inf), file, line);
+ INVOKE_LMI_TEST_EQUAL(-to_inf, bourn_cast<To>(-from_inf), file, line);
}
else
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<To>( from_traits::infinity())
,std::runtime_error
,"This cast should have succeeded."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<To>(-from_traits::infinity())
,std::runtime_error
,"This cast should have succeeded."
@@ -296,7 +296,7 @@ void test_floating_conversions(char const* file, int line)
// NaNs.
From const from_qnan = from_traits::quiet_NaN();
- INVOKE_BOOST_TEST(std::isnan(bourn_cast<To>(from_qnan)), file, line);
+ INVOKE_LMI_TEST(std::isnan(bourn_cast<To>(from_qnan)), file, line);
}
/// Test conversions between integral and floating types [conv.fpint].
@@ -321,11 +321,11 @@ void test_conv_fpint(char const* file, int line)
if(i_traits::digits <= f_traits::digits)
{
- INVOKE_BOOST_TEST_EQUAL(i_hi, bourn_cast<I>(f_i_hi), file, line);
+ INVOKE_LMI_TEST_EQUAL(i_hi, bourn_cast<I>(f_i_hi), file, line);
}
else
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(f_i_hi)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -336,7 +336,7 @@ void test_conv_fpint(char const* file, int line)
F const f_i_lo = bourn_cast<F>(i_lo);
#if !defined TEST_BOOST_CAST_INSTEAD
- INVOKE_BOOST_TEST_EQUAL(i_lo, bourn_cast<I>(f_i_lo), file, line);
+ INVOKE_LMI_TEST_EQUAL(i_lo, bourn_cast<I>(f_i_lo), file, line);
#else // defined TEST_BOOST_CAST_INSTEAD
// boost::numeric_cast throws on conversions:
// -9223372036854775808.0f --> 64-bit signed int
@@ -344,11 +344,11 @@ void test_conv_fpint(char const* file, int line)
// -9223372036854775808.0 --> 64-bit signed int
if(!i_traits::is_signed || i_traits::digits <= f_traits::digits)
{
- INVOKE_BOOST_TEST_EQUAL(i_lo, bourn_cast<I>(f_i_lo), file, line);
+ INVOKE_LMI_TEST_EQUAL(i_lo, bourn_cast<I>(f_i_lo), file, line);
}
else
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(f_i_lo)
,std::runtime_error
,"This cast should have succeeded."
@@ -367,26 +367,26 @@ void test_conv_fpint(char const* file, int line)
// An integer-valued floating-point number has no fractional part
// to truncate, so converting it to an integral type wide enough
// to represent it preserves value.
- INVOKE_BOOST_TEST_EQUAL(I(3), bourn_cast<I>(F(3)), file, line);
+ INVOKE_LMI_TEST_EQUAL(I(3), bourn_cast<I>(F(3)), file, line);
// From positive zero.
- INVOKE_BOOST_TEST_EQUAL(I(0), bourn_cast<I>(+F(0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(I(0), bourn_cast<I>(+F(0)), file, line);
// From negative zero. Interestingly, this negative value is
// properly convertible to an unsigned integral type.
- INVOKE_BOOST_TEST_EQUAL(I(0), bourn_cast<I>(-F(0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(I(0), bourn_cast<I>(-F(0)), file, line);
// Out of bounds.
// Floating-point lowest and highest values are not necessarily
// outside the range of all integral types, but they almost
// certainly are for standard types.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(f_traits::max())
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(f_traits::lowest())
,std::runtime_error
, (i_traits::is_signed
@@ -396,14 +396,14 @@ void test_conv_fpint(char const* file, int line)
);
// From +inf.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(+f_traits::infinity())
,std::runtime_error
,"Cannot cast infinite to integral."
);
// From -inf.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(-f_traits::infinity())
,std::runtime_error
,"Cannot cast infinite to integral."
@@ -414,7 +414,7 @@ void test_conv_fpint(char const* file, int line)
// Truncating.
#if !defined TEST_BOOST_CAST_INSTEAD
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(F(3.14))
,std::runtime_error
,lmi_test::what_regex("^Cast.*would not preserve value\\.$")
@@ -422,11 +422,11 @@ void test_conv_fpint(char const* file, int line)
#else // defined TEST_BOOST_CAST_INSTEAD
// boost::numeric cast truncates whereas bourn_cast throws; both
// are deliberate design decisions.
- INVOKE_BOOST_TEST_EQUAL(3, bourn_cast<I>(F(3.14)), file, line);
+ INVOKE_LMI_TEST_EQUAL(3, bourn_cast<I>(F(3.14)), file, line);
#endif // defined TEST_BOOST_CAST_INSTEAD
// From NaN.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<I>(f_traits::quiet_NaN())
,std::runtime_error
,"Cannot cast NaN to integral."
@@ -474,16 +474,16 @@ void test_m64_neighborhood()
#if defined __GNUC__
# pragma GCC diagnostic pop
#endif // defined __GNUC__
- BOOST_TEST(f_ull_max == static_cast<float>(ull_max));
+ LMI_TEST(f_ull_max == static_cast<float>(ull_max));
// Suppressed because behavior is undefined:
- // BOOST_TEST(ull_max == static_cast<unsigned long long int>(f_ull_max));
+ // LMI_TEST(ull_max == static_cast<unsigned long long int>(f_ull_max));
// However, unlike static_cast, bourn_cast refuses to cast 2^64
// to a 64-bit integer, because it is out of range and therefore
// would constitute UB.
- BOOST_TEST_EQUAL(f_ull_max, bourn_cast<float>(ull_max));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(f_ull_max, bourn_cast<float>(ull_max));
+ LMI_TEST_THROW
(bourn_cast<unsigned long long int>(f_ull_max)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -495,7 +495,7 @@ void test_m64_neighborhood()
unsigned long long int const ull_hi = ull_traits::max() - 2; // 2^64 - 3
float const f_ull_hi = bourn_cast<float>(ull_hi);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned long long int>(f_ull_hi)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -515,7 +515,7 @@ void test_m64_neighborhood()
# pragma GCC diagnostic pop
#endif // defined __GNUC__
float const f_interesting = bourn_cast<float>(ull_interesting);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned long long int>(f_interesting)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -527,7 +527,7 @@ void test_m64_neighborhood()
// mantissa bits cannot represent a value this close to 2^64.
double const d_ull_hi = bourn_cast<double>(ull_hi);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned long long int>(d_ull_hi)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -540,7 +540,7 @@ void test_m64_neighborhood()
if(ull_traits::digits <= ld_traits::digits)
{
long double const ld_ull_hi = bourn_cast<long double>(ull_hi);
- BOOST_TEST_EQUAL(ull_hi, bourn_cast<unsigned long long
int>(ld_ull_hi));
+ LMI_TEST_EQUAL(ull_hi, bourn_cast<unsigned long long int>(ld_ull_hi));
}
// These circumstances for gcc on i686 or x86_64:
@@ -565,10 +565,10 @@ void test_m64_neighborhood()
signed long long int const sll_max = sll_traits::max();
long double const ld_sll_max = bourn_cast<long double>(sll_max);
- BOOST_TEST_EQUAL(sll_max, bourn_cast<signed long long
int>(ld_sll_max));
+ LMI_TEST_EQUAL(sll_max, bourn_cast<signed long long int>(ld_sll_max));
long double const ld_sll_too_high = ld_sll_max + 1;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<signed long long int>(ld_sll_too_high)
,std::runtime_error
,"Cast would transgress upper limit."
@@ -577,10 +577,10 @@ void test_m64_neighborhood()
signed long long int const sll_min = sll_traits::min();
long double const ld_sll_min = bourn_cast<long double>(sll_min);
- BOOST_TEST_EQUAL(sll_min, bourn_cast<signed long long
int>(ld_sll_min));
+ LMI_TEST_EQUAL(sll_min, bourn_cast<signed long long int>(ld_sll_min));
long double const ld_sll_too_low = ld_sll_min - 1;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<signed long long int>(ld_sll_too_low)
,std::runtime_error
,"Cast would transgress lower limit."
@@ -605,7 +605,7 @@ void test_boost_anomalies()
// operand cannot be represented in the destination format and this
// cannot otherwise be indicated, the invalid operation exception shall
// be signaled."
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<int>(double_traits::quiet_NaN())
,std::runtime_error
,"Cannot cast NaN to integral."
@@ -620,9 +620,9 @@ void test_boost_anomalies()
// That worked, so this should too...
bourn_cast<float>(double_traits::infinity());
// ...because all infinities are convertible.
- BOOST_TEST(true);
+ LMI_TEST(true);
}
- catch(...) {BOOST_TEST(false);}
+ catch(...) {LMI_TEST(false);}
try
{
@@ -631,9 +631,9 @@ void test_boost_anomalies()
// That worked, so this should too...
bourn_cast<int>((float)INT_MIN);
// ...because INT_MIN = an exact power of 2.
- BOOST_TEST(true);
+ LMI_TEST(true);
}
- catch(...) {BOOST_TEST(false);}
+ catch(...) {LMI_TEST(false);}
try
{
@@ -641,9 +641,9 @@ void test_boost_anomalies()
// That worked, so this should too...
bourn_cast<long long int>((float)LLONG_MIN);
// ...because LLONG_MIN = an exact power of 2.
- BOOST_TEST(true);
+ LMI_TEST(true);
}
- catch(...) {BOOST_TEST(false);}
+ catch(...) {LMI_TEST(false);}
try
{
@@ -651,9 +651,9 @@ void test_boost_anomalies()
// That worked, so this should too...
bourn_cast<long long int>((double)LLONG_MIN);
// ...because LLONG_MIN = an exact power of 2.
- BOOST_TEST(true);
+ LMI_TEST(true);
}
- catch(...) {BOOST_TEST(false);}
+ catch(...) {LMI_TEST(false);}
}
/// Speed test: convert one million times, using static_cast.
@@ -721,12 +721,12 @@ int test_main(int, char*[])
{
// Motivating case. This test fails: -1 really isn't less than 1U.
// (The test is suppressed to avoid a compiler warning.)
-// BOOST_TEST(-1 < 1U);
+// LMI_TEST(-1 < 1U);
// This test succeeds: -1 is less than 1, as expected.
- BOOST_TEST(-1 < bourn_cast<int>(1U));
+ LMI_TEST(-1 < bourn_cast<int>(1U));
// This test throws: instead of converting a negative value to
// unsigned, bourn_cast throws an exception.
-// BOOST_TEST(bourn_cast<unsigned int>(-1) < 1U);
+// LMI_TEST(bourn_cast<unsigned int>(-1) < 1U);
// Trivially cast to same type.
@@ -756,16 +756,16 @@ int test_main(int, char*[])
// are guaranteed to cover such diversity, even on a machine where
// unsigned char and unsigned long long int are synonyms.
- BOOST_TEST_EQUAL(true , bourn_cast<bool>(static_cast<signed char>(1)));
- BOOST_TEST_EQUAL(false, bourn_cast<bool>(static_cast<signed char>(0)));
+ LMI_TEST_EQUAL(true , bourn_cast<bool>(static_cast<signed char>(1)));
+ LMI_TEST_EQUAL(false, bourn_cast<bool>(static_cast<signed char>(0)));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<bool>(static_cast<signed char>(2))
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<bool>(static_cast<signed char>(-1))
,std::runtime_error
,"Cannot cast negative to unsigned."
@@ -828,27 +828,27 @@ int test_main(int, char*[])
// Attempt forbidden conversion from negative to unsigned.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned char>(std::numeric_limits<signed char>::lowest())
,std::runtime_error
,"Cannot cast negative to unsigned."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned int >(std::numeric_limits<signed int >::lowest())
,std::runtime_error
,"Cannot cast negative to unsigned."
);
// Still forbidden even if unsigned type is wider than signed type.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned long int>(std::numeric_limits<signed
char>::lowest())
,std::runtime_error
,"Cannot cast negative to unsigned."
);
// Still forbidden even if value is only "slightly" negative.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned long int>(-1)
,std::runtime_error
,"Cannot cast negative to unsigned."
@@ -860,7 +860,7 @@ int test_main(int, char*[])
// attempted conversion of a negative value to an unsigned type.
#if LLONG_MIN < SCHAR_MIN
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<signed char>(LLONG_MIN)
,std::runtime_error
,"Cast would transgress lower limit."
@@ -870,20 +870,20 @@ int test_main(int, char*[])
// Transgress upper limit.
#if UCHAR_MAX < ULLONG_MAX
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<unsigned char>(ULLONG_MAX)
,std::runtime_error
,"Cast would transgress upper limit."
);
#endif // UCHAR_MAX < ULLONG_MAX
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<signed char>(std::numeric_limits<unsigned char>::max())
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<signed int >(std::numeric_limits<unsigned int >::max())
,std::runtime_error
,"Cast would transgress upper limit."
diff --git a/cache_file_reads_test.cpp b/cache_file_reads_test.cpp
index 9120a56..9fb48ee 100644
--- a/cache_file_reads_test.cpp
+++ b/cache_file_reads_test.cpp
@@ -75,13 +75,13 @@ void cache_file_reads_test::test_preconditions()
X x0("sample.ill");
// The cache is accessible with or without an object.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(x0.read_via_cache("sample.ill")->s()
,X::read_via_cache("sample.ill")->s()
);
// The file must exist.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(X::read_via_cache("no_such_file")
,boost::filesystem::filesystem_error
,lmi_test::what_regex("no_such_file")
diff --git a/calendar_date_test.cpp b/calendar_date_test.cpp
index 7f1d716..52e35bb 100644
--- a/calendar_date_test.cpp
+++ b/calendar_date_test.cpp
@@ -90,41 +90,41 @@ void CalendarDateTest::TestFundamentals()
// This test is not performed because it can fail if midnight is
// crossed between it and the preceding statement, and also
// because its success proves nothing.
-// BOOST_TEST_EQUAL(date0, today());
+// LMI_TEST_EQUAL(date0, today());
// Copy ctor.
calendar_date date1(date0);
- BOOST_TEST_EQUAL(date0, date1);
+ LMI_TEST_EQUAL(date0, date1);
// Construct from year, month, and day.
calendar_date date2(1899, 12, 31);
- BOOST_TEST_EQUAL(dublin_epoch, date2);
+ LMI_TEST_EQUAL(dublin_epoch, date2);
// Construct from jdn_t.
calendar_date date3(jdn_t(2415020));
- BOOST_TEST_EQUAL(dublin_epoch, date3);
+ LMI_TEST_EQUAL(dublin_epoch, date3);
// Construct from ymd_t.
calendar_date date4(ymd_t(18991231));
- BOOST_TEST_EQUAL(dublin_epoch, date4);
+ LMI_TEST_EQUAL(dublin_epoch, date4);
// *** Assignment.
// Copy assignment operator.
date1 = gregorian_epoch();
- BOOST_TEST_EQUAL(gregorian_epoch(), date1);
+ LMI_TEST_EQUAL(gregorian_epoch(), date1);
// Assign from self.
date1 = date1;
- BOOST_TEST_EQUAL(gregorian_epoch(), date1);
+ LMI_TEST_EQUAL(gregorian_epoch(), date1);
// Assign from jdn_t.
date2 = jdn_t(2361222);
- BOOST_TEST_EQUAL(gregorian_epoch(), date2);
+ LMI_TEST_EQUAL(gregorian_epoch(), date2);
// Assign from ymd_t.
date3 = ymd_t(17520914);
- BOOST_TEST_EQUAL(gregorian_epoch(), date3);
+ LMI_TEST_EQUAL(gregorian_epoch(), date3);
}
/// Verify an upper and a lower bound for ACM Algorithm 199. The upper
@@ -163,25 +163,25 @@ void CalendarDateTest::TestYMDBounds()
{
// Test arguments that are prima facie out of bounds.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 2000, 0, 1)
,std::runtime_error
,"Date 2000-00-01 is invalid. Perhaps 1999-12-01 was meant."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 2000, 13, 1)
,std::runtime_error
,"Date 2000-13-01 is invalid. Perhaps 2001-01-01 was meant."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 2000, 1, 0)
,std::runtime_error
,"Date 2000-01-00 is invalid. Perhaps 1999-12-31 was meant."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 2000, 1, 32)
,std::runtime_error
,"Date 2000-01-32 is invalid. Perhaps 2000-02-01 was meant."
@@ -189,19 +189,19 @@ void CalendarDateTest::TestYMDBounds()
// Test arguments that are out of bounds only in context.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 2000, 2, 30)
,std::runtime_error
,"Date 2000-02-30 is invalid. Perhaps 2000-03-01 was meant."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 1900, 2, 29)
,std::runtime_error
,"Date 1900-02-29 is invalid. Perhaps 1900-03-01 was meant."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(calendar_date( 1999, 9, 31)
,std::runtime_error
,"Date 1999-09-31 is invalid. Perhaps 1999-10-01 was meant."
@@ -210,51 +210,51 @@ void CalendarDateTest::TestYMDBounds()
void CalendarDateTest::TestYmdToJdnAndJdnToYmd()
{
- BOOST_TEST_EQUAL(2361222, YmdToJdn(ymd_t(17520914)).value());
- BOOST_TEST_EQUAL(17520914, JdnToYmd(jdn_t(2361222)).value());
+ LMI_TEST_EQUAL(2361222, YmdToJdn(ymd_t(17520914)).value());
+ LMI_TEST_EQUAL(17520914, JdnToYmd(jdn_t(2361222)).value());
- BOOST_TEST_EQUAL(2400000, YmdToJdn(ymd_t(18581116)).value());
- BOOST_TEST_EQUAL(18581116, JdnToYmd(jdn_t(2400000)).value());
+ LMI_TEST_EQUAL(2400000, YmdToJdn(ymd_t(18581116)).value());
+ LMI_TEST_EQUAL(18581116, JdnToYmd(jdn_t(2400000)).value());
ymd_t const z0(18581116);
- BOOST_TEST_EQUAL(2400000, calendar_date(z0).julian_day_number());
+ LMI_TEST_EQUAL(2400000, calendar_date(z0).julian_day_number());
jdn_t const z1(YmdToJdn(ymd_t(18581116)));
- BOOST_TEST_EQUAL(2400000, calendar_date(z1).julian_day_number());
+ LMI_TEST_EQUAL(2400000, calendar_date(z1).julian_day_number());
}
void CalendarDateTest::TestLeapYear()
{
- BOOST_TEST(!calendar_date(1900, 1, 1).is_leap_year());
- BOOST_TEST( calendar_date(2000, 1, 1).is_leap_year());
- BOOST_TEST(!calendar_date(2003, 1, 1).is_leap_year());
- BOOST_TEST( calendar_date(2004, 1, 1).is_leap_year());
- BOOST_TEST( calendar_date(4000, 1, 1).is_leap_year());
+ LMI_TEST(!calendar_date(1900, 1, 1).is_leap_year());
+ LMI_TEST( calendar_date(2000, 1, 1).is_leap_year());
+ LMI_TEST(!calendar_date(2003, 1, 1).is_leap_year());
+ LMI_TEST( calendar_date(2004, 1, 1).is_leap_year());
+ LMI_TEST( calendar_date(4000, 1, 1).is_leap_year());
}
void CalendarDateTest::TestMixedModeArithmetic()
{
calendar_date const d = calendar_date(2003, 12, 31);
- BOOST_TEST_EQUAL( 1 + d, calendar_date(2004, 1, 1));
- BOOST_TEST_EQUAL( d + 1, calendar_date(2004, 1, 1));
- BOOST_TEST_EQUAL( d - 1, calendar_date(2003, 12, 30));
-// BOOST_TEST_EQUAL( 1 - d, calendar_date(2004, 12, 30)); // forbidden
- BOOST_TEST_EQUAL(1 + d - 1, calendar_date(2003, 12, 31));
+ LMI_TEST_EQUAL( 1 + d, calendar_date(2004, 1, 1));
+ LMI_TEST_EQUAL( d + 1, calendar_date(2004, 1, 1));
+ LMI_TEST_EQUAL( d - 1, calendar_date(2003, 12, 30));
+// LMI_TEST_EQUAL( 1 - d, calendar_date(2004, 12, 30)); // forbidden
+ LMI_TEST_EQUAL(1 + d - 1, calendar_date(2003, 12, 31));
- BOOST_TEST_EQUAL( 3 + d, calendar_date(2004, 1, 3));
- BOOST_TEST_EQUAL( d + 3, calendar_date(2004, 1, 3));
- BOOST_TEST_EQUAL( d - 3, calendar_date(2003, 12, 28));
- BOOST_TEST_EQUAL(3 + d - 3, calendar_date(2003, 12, 31));
- BOOST_TEST_EQUAL(7 + d - 5, calendar_date(2004, 1, 2));
+ LMI_TEST_EQUAL( 3 + d, calendar_date(2004, 1, 3));
+ LMI_TEST_EQUAL( d + 3, calendar_date(2004, 1, 3));
+ LMI_TEST_EQUAL( d - 3, calendar_date(2003, 12, 28));
+ LMI_TEST_EQUAL(3 + d - 3, calendar_date(2003, 12, 31));
+ LMI_TEST_EQUAL(7 + d - 5, calendar_date(2004, 1, 2));
calendar_date e = calendar_date(2000, 2, 28);
-// BOOST_TEST_EQUAL( 3 += e, calendar_date(2000, 3, 3)); // forbidden
- BOOST_TEST_EQUAL( e += 3, calendar_date(2000, 3, 2));
- BOOST_TEST_EQUAL( e -= 3, calendar_date(2000, 2, 28));
- BOOST_TEST_EQUAL(3 + e -= 3, calendar_date(2000, 2, 28));
- BOOST_TEST_EQUAL(7 + e -= 5, calendar_date(2000, 3, 1));
+// LMI_TEST_EQUAL( 3 += e, calendar_date(2000, 3, 3)); // forbidden
+ LMI_TEST_EQUAL( e += 3, calendar_date(2000, 3, 2));
+ LMI_TEST_EQUAL( e -= 3, calendar_date(2000, 2, 28));
+ LMI_TEST_EQUAL(3 + e -= 3, calendar_date(2000, 2, 28));
+ LMI_TEST_EQUAL(7 + e -= 5, calendar_date(2000, 3, 1));
}
void CalendarDateTest::TestIncrementing()
@@ -272,40 +272,40 @@ void CalendarDateTest::TestIncrementing()
birth_date = calendar_date(2003, 1, 1);
birth_date = add_years(birth_date, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2004, 1, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2004, 1, 1));
birth_date = calendar_date(2003, 12, 31);
birth_date = add_years(birth_date, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2004, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2004, 12, 31));
birth_date = calendar_date(1996, 2, 29);
birth_date = add_years(birth_date, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1997, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1997, 3, 1));
birth_date = calendar_date(1996, 2, 29);
birth_date = add_years(birth_date, 4, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
birth_date = add_years(birth_date, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
// Curtate tests.
birth_date = calendar_date(2003, 1, 1);
birth_date = add_years(birth_date, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2004, 1, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2004, 1, 1));
birth_date = calendar_date(2003, 12, 31);
birth_date = add_years(birth_date, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2004, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2004, 12, 31));
birth_date = calendar_date(1996, 2, 29);
birth_date = add_years(birth_date, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1997, 2, 28));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1997, 2, 28));
birth_date = calendar_date(1996, 2, 29);
birth_date = add_years(birth_date, 4, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
birth_date = add_years(birth_date, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
// Test incrementing by a whole number of months and years.
@@ -313,101 +313,101 @@ void CalendarDateTest::TestIncrementing()
birth_date = calendar_date(1996, 1, 29);
birth_date = add_years_and_months(birth_date, 0, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
birth_date = add_years_and_months(birth_date, 4, 0, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
birth_date = add_years_and_months(birth_date, 1, 0, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 11, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 1, -1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, -4, 11, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, -3, -1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, -37, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 3, 1));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 9, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 10, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 1, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 1, 31));
birth_date = calendar_date(1994, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 21, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
birth_date = calendar_date(2001, 1, 31);
birth_date = add_years_and_months(birth_date, 0, 1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 3, 1));
birth_date = calendar_date(2001, 1, 31);
birth_date = add_years_and_months(birth_date, 0, 3, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 5, 1));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 5, 1));
// Curtate tests.
birth_date = calendar_date(1996, 1, 29);
birth_date = add_years_and_months(birth_date, 0, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
birth_date = add_years_and_months(birth_date, 4, 0, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2000, 2, 29));
birth_date = add_years_and_months(birth_date, 1, 0, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 11, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 1, -1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 2, 29));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, -4, 11, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, -3, -1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, -37, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1992, 2, 29));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 9, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
birth_date = calendar_date(1995, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 10, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1996, 1, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1996, 1, 31));
birth_date = calendar_date(1994, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 21, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 12, 31));
birth_date = calendar_date(2001, 1, 31);
birth_date = add_years_and_months(birth_date, 0, 1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 2, 28));
birth_date = calendar_date(2001, 1, 31);
birth_date = add_years_and_months(birth_date, 0, 3, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2001, 4, 30));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2001, 4, 30));
// Test the example in this comment block that appears in a
// different translation unit:
@@ -422,11 +422,11 @@ void CalendarDateTest::TestIncrementing()
birth_date = calendar_date(2002, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 11, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2003, 2, 28));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2003, 2, 28));
birth_date = calendar_date(2002, 3, 31);
birth_date = add_years_and_months(birth_date, 0, 12, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(2003, 3, 31));
+ LMI_TEST_EQUAL(birth_date, calendar_date(2003, 3, 31));
// Test constructing a plausible birthdate, given an as-of date
// and an attained age only. Because the month and date of birth
@@ -442,14 +442,14 @@ void CalendarDateTest::TestIncrementing()
// shows, the resulting age does not equal the intended age.
birth_date = add_years(as_of_date, -1, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 3, 1));
- BOOST_TEST_UNEQUAL(1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 3, 1));
+ LMI_TEST_UNEQUAL(1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
// A "curtate" calculation gives a correct answer.
birth_date = add_years(as_of_date, -1, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 2, 28));
- BOOST_TEST_EQUAL (1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 2, 28));
+ LMI_TEST_EQUAL (1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
// It is important not to overgeneralize and suppose that curtate
// calculations somehow fit best with negative increments: that's
@@ -459,12 +459,12 @@ void CalendarDateTest::TestIncrementing()
calendar_date const some_other_date = calendar_date(1956, 2, 29);
birth_date = add_years(some_other_date, 39, false);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 3, 1));
- BOOST_TEST_UNEQUAL(1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 3, 1));
+ LMI_TEST_UNEQUAL(1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
birth_date = add_years(some_other_date, 39, true);
- BOOST_TEST_EQUAL(birth_date, calendar_date(1995, 2, 28));
- BOOST_TEST_EQUAL (1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(birth_date, calendar_date(1995, 2, 28));
+ LMI_TEST_EQUAL (1, attained_age(birth_date, as_of_date,
oe_age_last_birthday));
}
void CalendarDateTest::TestAgeCalculations()
@@ -482,16 +482,16 @@ void CalendarDateTest::TestAgeCalculations()
calendar_date birth_date;
birth_date = calendar_date(1958, 7, 2);
- BOOST_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// If birthdate is one day later, then ANB is one year less.
birth_date = calendar_date(1958, 7, 3);
- BOOST_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(44, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// In a leap year, effective date can be an equal number of days
// away from the two birthdays that bracket it. For ANB, either
@@ -510,25 +510,25 @@ void CalendarDateTest::TestAgeCalculations()
effective_date = calendar_date(2004, 1, 1);
birth_date = calendar_date(1958, 7, 2);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// If birthdate is one day earlier,
// then ANB is unambiguously forty-six.
birth_date = calendar_date(1958, 7, 1);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// If birthdate is one day later,
// then ANB is unambiguously forty-five.
birth_date = calendar_date(1958, 7, 3);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// Test leap-year-day birthdate.
//
@@ -546,54 +546,54 @@ void CalendarDateTest::TestAgeCalculations()
birth_date = calendar_date(1956, 2, 29);
effective_date = calendar_date(2003, 8, 30);
- BOOST_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2003, 8, 31);
- BOOST_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 2, 28);
- BOOST_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(47, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 2, 29);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 3, 1);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 8, 29);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 8, 30);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2004, 8, 31);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2005, 2, 28);
- BOOST_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(48, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
effective_date = calendar_date(2005, 3, 1);
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(49, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// Test leap-year-day effective date. Business custom would forbid
// using it as the basis for a series of annual transactions, yet
@@ -613,24 +613,24 @@ void CalendarDateTest::TestAgeCalculations()
effective_date = calendar_date(2004, 2, 29);
birth_date = calendar_date(1958, 8, 29);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
birth_date = calendar_date(1958, 8, 30);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(46, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
birth_date = calendar_date(1958, 8, 31);
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
- BOOST_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_last_birthday));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_younger));
+ LMI_TEST_EQUAL(45, attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older));
// Effective date mustn't precede birthdate--this should throw:
birth_date = calendar_date(2003, 1, 2);
effective_date = calendar_date(2003, 1, 1);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(attained_age(birth_date, effective_date,
oe_age_nearest_birthday_ties_older)
,std::runtime_error
,"As-of date (2003-01-01) precedes birthdate (2003-01-02)."
@@ -648,135 +648,135 @@ void CalendarDateTest::TestIntegralDuration()
// Test whole-year intervals.
other_date = calendar_date(1999, 1, 1);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
+ LMI_TEST_THROW
(years_and_months_since(base_date, other_date, true)
,std::runtime_error
,"Second date (1999-01-01) precedes first date (2000-01-01)."
);
other_date = calendar_date(2000, 1, 1);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
other_date = calendar_date(2001, 1, 1);
- BOOST_TEST_EQUAL( 1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
// Test non-whole-year intervals.
other_date = calendar_date(1999, 2, 2);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
other_date = calendar_date(2000, 2, 2);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
other_date = calendar_date(2001, 2, 2);
- BOOST_TEST_EQUAL( 1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 2, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 2, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
// Test leap-year-day base date.
base_date = calendar_date(2000, 2, 29);
other_date = calendar_date(1999, 2, 28);
- BOOST_TEST_EQUAL(-2, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-2, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
other_date = calendar_date(1999, 3, 1);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
other_date = calendar_date(2000, 2, 28);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
other_date = calendar_date(2000, 2, 29);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
other_date = calendar_date(2000, 3, 1);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
other_date = calendar_date(2001, 2, 28);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
other_date = calendar_date(2001, 3, 1);
- BOOST_TEST_EQUAL( 1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
// Test leap-year-day other date.
other_date = calendar_date(2000, 2, 29);
base_date = calendar_date(1999, 2, 28);
- BOOST_TEST_EQUAL( 1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 2, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 2, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
base_date = calendar_date(1999, 3, 1);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL(11, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL(11, ym.second);
base_date = calendar_date(2000, 2, 28);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 1, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
base_date = calendar_date(2000, 2, 29);
- BOOST_TEST_EQUAL( 0, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
base_date = calendar_date(2000, 3, 1);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
base_date = calendar_date(2001, 2, 28);
- BOOST_TEST_EQUAL(-1, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL( 0, duration_ceiling(base_date, other_date));
base_date = calendar_date(2001, 3, 1);
- BOOST_TEST_EQUAL(-2, duration_floor (base_date, other_date));
- BOOST_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
+ LMI_TEST_EQUAL(-2, duration_floor (base_date, other_date));
+ LMI_TEST_EQUAL(-1, duration_ceiling(base_date, other_date));
// Test years_and_months_since()'s 'is_curtate' argument.
@@ -784,61 +784,61 @@ void CalendarDateTest::TestIntegralDuration()
other_date = calendar_date(2001, 1, 15);
// Curtate: count full months completed during interval.
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
// Not curtate: count months begun during interval.
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
base_date = calendar_date(2000, 1, 15);
other_date = calendar_date(2001, 2, 1);
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
// Curtate == non-curtate for identical dates.
base_date = calendar_date(2000, 1, 1);
other_date = calendar_date(2000, 1, 1);
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 0, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 0, ym.second);
// Curtate == non-curtate for exact monthiversaries.
base_date = calendar_date(2000, 1, 1);
other_date = calendar_date(2001, 2, 1);
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 1, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 1, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
// Interval beginning on leap-year day.
base_date = calendar_date(2000, 2, 29);
other_date = calendar_date(2001, 1, 1);
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL(10, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL(10, ym.second);
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL(11, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL(11, ym.second);
// Interval ending on leap-year day.
base_date = calendar_date(2000, 1, 1);
other_date = calendar_date(2000, 2, 29);
ym = years_and_months_since(base_date, other_date, true);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 1, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 1, ym.second);
ym = years_and_months_since(base_date, other_date, false);
- BOOST_TEST_EQUAL( 0, ym.first );
- BOOST_TEST_EQUAL( 2, ym.second);
+ LMI_TEST_EQUAL( 0, ym.first );
+ LMI_TEST_EQUAL( 2, ym.second);
// Demonstrate strong noncommutativity. To show that
// duration_floor(X, Y)
@@ -850,25 +850,25 @@ void CalendarDateTest::TestIntegralDuration()
calendar_date date1(2001, 3, 1);
calendar_date date2(2003, 1, 1);
- int f01 = duration_floor (date0, date1); BOOST_TEST_EQUAL( 0, f01);
- int f10 = duration_floor (date1, date0); BOOST_TEST_EQUAL(-1, f10);
+ int f01 = duration_floor (date0, date1); LMI_TEST_EQUAL( 0, f01);
+ int f10 = duration_floor (date1, date0); LMI_TEST_EQUAL(-1, f10);
- int f02 = duration_floor (date0, date2); BOOST_TEST_EQUAL( 2, f02);
- int f20 = duration_floor (date2, date0); BOOST_TEST_EQUAL(-2, f20);
+ int f02 = duration_floor (date0, date2); LMI_TEST_EQUAL( 2, f02);
+ int f20 = duration_floor (date2, date0); LMI_TEST_EQUAL(-2, f20);
- BOOST_TEST_UNEQUAL(f01, -f10);
- BOOST_TEST_EQUAL (f02, -f20);
+ LMI_TEST_UNEQUAL(f01, -f10);
+ LMI_TEST_EQUAL (f02, -f20);
// duration_ceiling is similarly noncommutative.
- int c01 = duration_ceiling(date0, date1); BOOST_TEST_EQUAL( 1, c01);
- int c10 = duration_ceiling(date1, date0); BOOST_TEST_EQUAL( 0, c10);
+ int c01 = duration_ceiling(date0, date1); LMI_TEST_EQUAL( 1, c01);
+ int c10 = duration_ceiling(date1, date0); LMI_TEST_EQUAL( 0, c10);
- int c02 = duration_ceiling(date0, date2); BOOST_TEST_EQUAL( 2, c02);
- int c20 = duration_ceiling(date2, date0); BOOST_TEST_EQUAL(-2, c20);
+ int c02 = duration_ceiling(date0, date2); LMI_TEST_EQUAL( 2, c02);
+ int c20 = duration_ceiling(date2, date0); LMI_TEST_EQUAL(-2, c20);
- BOOST_TEST_UNEQUAL(c01, -c10);
- BOOST_TEST_EQUAL (c02, -c20);
+ LMI_TEST_UNEQUAL(c01, -c10);
+ LMI_TEST_EQUAL (c02, -c20);
}
void CalendarDateTest::TestYearAndMonthDifferenceExhaustively()
@@ -891,8 +891,8 @@ void
CalendarDateTest::TestYearAndMonthDifferenceExhaustively()
int m = ym.second;
calendar_date a = add_years_and_months(d, y, m , true);
calendar_date b = add_years_and_months(d, y, m + 1, true);
- BOOST_TEST(a <= e );
- BOOST_TEST( e < b);
+ LMI_TEST(a <= e );
+ LMI_TEST( e < b);
}
{
std::pair<int,int> ym = years_and_months_since(d, e, false);
@@ -900,8 +900,8 @@ void
CalendarDateTest::TestYearAndMonthDifferenceExhaustively()
int m = ym.second;
calendar_date a = add_years_and_months(d, y, m - 1, true);
calendar_date b = add_years_and_months(d, y, m , true);
- BOOST_TEST(a < e );
- BOOST_TEST( e <= b);
+ LMI_TEST(a < e );
+ LMI_TEST( e <= b);
}
}
}
@@ -911,20 +911,20 @@ void CalendarDateTest::TestBirthdateLimits()
{
// Test extrema.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(99, calendar_date(1852, 9, 13),
oe_age_last_birthday)
, calendar_date(1752, 9, 14)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate( 0, calendar_date(1852, 9, 13),
oe_age_last_birthday)
, calendar_date(1852, 9, 13)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(99, calendar_date(9999, 12, 31),
oe_age_last_birthday)
, calendar_date(9900, 1, 1)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate( 0, calendar_date(9999, 12, 31),
oe_age_last_birthday)
, calendar_date(9999, 12, 31)
);
@@ -932,20 +932,20 @@ void CalendarDateTest::TestBirthdateLimits()
// Test ANB limits, including equidistant birthdate candidates,
// resolving ties to the younger age.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(44, calendar_date(2003, 1, 1),
oe_age_nearest_birthday_ties_younger)
, calendar_date(1958, 7, 3)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate(45, calendar_date(2003, 1, 1),
oe_age_nearest_birthday_ties_younger)
, calendar_date(1958, 7, 2)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(45, calendar_date(2004, 1, 1),
oe_age_nearest_birthday_ties_younger)
, calendar_date(1958, 7, 2)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate(46, calendar_date(2004, 1, 1),
oe_age_nearest_birthday_ties_younger)
, calendar_date(1958, 7, 1)
);
@@ -954,20 +954,20 @@ void CalendarDateTest::TestBirthdateLimits()
// As expected, results change only in the "equidistant" case
// (which can arise only in a leap year).
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(44, calendar_date(2003, 1, 1),
oe_age_nearest_birthday_ties_older)
, calendar_date(1958, 7, 3)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate(45, calendar_date(2003, 1, 1),
oe_age_nearest_birthday_ties_older)
, calendar_date(1958, 7, 2)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(minimum_birthdate(45, calendar_date(2004, 1, 1),
oe_age_nearest_birthday_ties_older)
, calendar_date(1958, 7, 3)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(maximum_birthdate(46, calendar_date(2004, 1, 1),
oe_age_nearest_birthday_ties_older)
, calendar_date(1958, 7, 2)
);
@@ -984,25 +984,25 @@ void
CalendarDateTest::TestBirthdateLimitsExhaustively(oenum_alb_or_anb alb_anb)
for(int y = 0; y < 5; ++y)
{
calendar_date b0 = minimum_birthdate(y, d, alb_anb);
- BOOST_TEST_EQUAL(y, attained_age(b0, d, alb_anb));
+ LMI_TEST_EQUAL(y, attained_age(b0, d, alb_anb));
--b0;
- BOOST_TEST_UNEQUAL(y, attained_age(b0, d, alb_anb));
+ LMI_TEST_UNEQUAL(y, attained_age(b0, d, alb_anb));
calendar_date b1 = maximum_birthdate(y, d, alb_anb);
- BOOST_TEST_EQUAL(y, attained_age(b1, d, alb_anb));
+ LMI_TEST_EQUAL(y, attained_age(b1, d, alb_anb));
++b1;
if(0 == y) // Age would be negative.
{
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( b1.julian_day_number()
,1 + d.julian_day_number()
);
}
else
{
- BOOST_TEST_UNEQUAL(y, attained_age(b1, d, alb_anb));
+ LMI_TEST_UNEQUAL(y, attained_age(b1, d, alb_anb));
}
}
}
@@ -1010,62 +1010,62 @@ void
CalendarDateTest::TestBirthdateLimitsExhaustively(oenum_alb_or_anb alb_anb)
void CalendarDateTest::TestIo()
{
- BOOST_TEST_EQUAL("1752-09-14", gregorian_epoch().str());
- BOOST_TEST_EQUAL("9999-12-31", last_yyyy_date().str());
+ LMI_TEST_EQUAL("1752-09-14", gregorian_epoch().str());
+ LMI_TEST_EQUAL("9999-12-31", last_yyyy_date().str());
jdn_t min_jdn(calendar_date::min_verified_jdn);
- BOOST_TEST_EQUAL("0000-03-01", calendar_date(min_jdn).str());
+ LMI_TEST_EQUAL("0000-03-01", calendar_date(min_jdn).str());
- BOOST_TEST_EQUAL("1752-09-14", calendar_date(1752, 9, 14).str());
- BOOST_TEST_EQUAL("2001-01-01", calendar_date(2001, 1, 1).str());
+ LMI_TEST_EQUAL("1752-09-14", calendar_date(1752, 9, 14).str());
+ LMI_TEST_EQUAL("2001-01-01", calendar_date(2001, 1, 1).str());
calendar_date z(1956, 1, 13);
std::stringstream ss;
ss >> z;
- BOOST_TEST( ss.eof ());
- BOOST_TEST( ss.fail());
- BOOST_TEST(!ss.bad ());
- BOOST_TEST_EQUAL(calendar_date(1956, 1, 13), z);
+ LMI_TEST( ss.eof ());
+ LMI_TEST( ss.fail());
+ LMI_TEST(!ss.bad ());
+ LMI_TEST_EQUAL(calendar_date(1956, 1, 13), z);
ss.clear();
ss.str("0");
ss >> z;
- BOOST_TEST( ss.eof ());
- BOOST_TEST( ss.fail());
- BOOST_TEST(!ss.bad ());
- BOOST_TEST_EQUAL(calendar_date(1956, 1, 13), z);
+ LMI_TEST( ss.eof ());
+ LMI_TEST( ss.fail());
+ LMI_TEST(!ss.bad ());
+ LMI_TEST_EQUAL(calendar_date(1956, 1, 13), z);
ss.clear();
ss.str("");
ss << calendar_date(1752, 9, 14);
ss >> z;
- BOOST_TEST( ss.eof ());
- BOOST_TEST(!ss.fail());
- BOOST_TEST(!ss.bad ());
- BOOST_TEST_EQUAL(gregorian_epoch(), z);
+ LMI_TEST( ss.eof ());
+ LMI_TEST(!ss.fail());
+ LMI_TEST(!ss.bad ());
+ LMI_TEST_EQUAL(gregorian_epoch(), z);
// Of course, a different locale might use different strings.
- BOOST_TEST_EQUAL("January" , month_name( 1));
- BOOST_TEST_EQUAL("February" , month_name( 2));
- BOOST_TEST_EQUAL("March" , month_name( 3));
- BOOST_TEST_EQUAL("April" , month_name( 4));
- BOOST_TEST_EQUAL("May" , month_name( 5));
- BOOST_TEST_EQUAL("June" , month_name( 6));
- BOOST_TEST_EQUAL("July" , month_name( 7));
- BOOST_TEST_EQUAL("August" , month_name( 8));
- BOOST_TEST_EQUAL("September", month_name( 9));
- BOOST_TEST_EQUAL("October" , month_name(10));
- BOOST_TEST_EQUAL("November" , month_name(11));
- BOOST_TEST_EQUAL("December" , month_name(12));
-
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL("January" , month_name( 1));
+ LMI_TEST_EQUAL("February" , month_name( 2));
+ LMI_TEST_EQUAL("March" , month_name( 3));
+ LMI_TEST_EQUAL("April" , month_name( 4));
+ LMI_TEST_EQUAL("May" , month_name( 5));
+ LMI_TEST_EQUAL("June" , month_name( 6));
+ LMI_TEST_EQUAL("July" , month_name( 7));
+ LMI_TEST_EQUAL("August" , month_name( 8));
+ LMI_TEST_EQUAL("September", month_name( 9));
+ LMI_TEST_EQUAL("October" , month_name(10));
+ LMI_TEST_EQUAL("November" , month_name(11));
+ LMI_TEST_EQUAL("December" , month_name(12));
+
+ LMI_TEST_THROW
(month_name( 0)
,std::runtime_error
,"Month 0 is outside the range [1, 12]."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(month_name(13)
,std::runtime_error
,"Month 13 is outside the range [1, 12]."
diff --git a/callback_test.cpp b/callback_test.cpp
index ee546bd..0cdfd0c 100644
--- a/callback_test.cpp
+++ b/callback_test.cpp
@@ -90,7 +90,7 @@ int test_main(int, char*[])
application::initialize_callback();
shared_library::adder()(2, 3.0f, 5.0);
- BOOST_TEST_EQUAL(10.0, shared_library::adder()(2, 3.0f, 5.0));
+ LMI_TEST_EQUAL(10.0, shared_library::adder()(2, 3.0f, 5.0));
return EXIT_SUCCESS;
}
diff --git a/comma_punct_test.cpp b/comma_punct_test.cpp
index e53db36..2138e14 100644
--- a/comma_punct_test.cpp
+++ b/comma_punct_test.cpp
@@ -41,7 +41,7 @@ int test_main(int, char*[])
oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
oss << std::setprecision(2) << -999;
- BOOST_TEST_EQUAL("-999", oss.str());
+ LMI_TEST_EQUAL("-999", oss.str());
return EXIT_SUCCESS;
}
diff --git a/commutation_functions_test.cpp b/commutation_functions_test.cpp
index 3dfbfc6..b56e480 100644
--- a/commutation_functions_test.cpp
+++ b/commutation_functions_test.cpp
@@ -190,7 +190,7 @@ void TestEckleyTable2()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "Table 2; Ax and ax:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -225,7 +225,7 @@ void TestEckleyTable2()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "Table 2; Px and Vx:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -310,7 +310,7 @@ void TestEckleyTables3and4()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "Tables 3 and 4; Px and Vx:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -393,7 +393,7 @@ void TestEckleyTable5()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "Table 5; Dx, Dx12, and Cx12:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -554,7 +554,7 @@ void Test_1954_1958_IET_3pct()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "1954-1958 IET 3%; Dx, Nx, Cx, and Mx:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -656,7 +656,7 @@ void Test_1980_CSO_Male_ANB()
;
}
}
- BOOST_TEST_RELATION(worst_discrepancy,<,tolerance);
+ LMI_TEST_RELATION(worst_discrepancy,<,tolerance);
std::cout
<< "Yearly account values:\n"
<< std::setiosflags(std::ios_base::fixed)
@@ -713,8 +713,8 @@ void TestLimits()
{
std::vector<double> zero(10, 0.0);
ULCommFns ulcf(zero, zero, zero, mce_option1_for_7702, mce_monthly);
- BOOST_TEST_EQUAL(1.0, ulcf.aDomega());
- BOOST_TEST_EQUAL(0.0, ulcf.kC().back());
+ LMI_TEST_EQUAL(1.0, ulcf.aDomega());
+ LMI_TEST_EQUAL(0.0, ulcf.kC().back());
}
int test_main(int, char*[])
diff --git a/configurable_settings_test.cpp b/configurable_settings_test.cpp
index d5839f9..28a8ae9 100644
--- a/configurable_settings_test.cpp
+++ b/configurable_settings_test.cpp
@@ -51,7 +51,7 @@ class configurable_settings_test
void configurable_settings_test::test_normal_usage()
{
configurable_settings const& c = configurable_settings::instance();
- BOOST_TEST(!c.skin_filename().empty());
+ LMI_TEST(!c.skin_filename().empty());
}
/// Save a copy of the file multiple times (because users might).
@@ -88,11 +88,11 @@ void
configurable_settings_test::test_backward_compatibility()
configurable_settings& c = configurable_settings::instance();
c.xml_serializable<configurable_settings>::load(filename);
- BOOST_TEST_EQUAL("[renamed]" , c.custom_input_0_filename());
- BOOST_TEST_EQUAL("custom.inix" , c.custom_input_1_filename());
- BOOST_TEST_EQUAL("[renamed]" , c.custom_output_0_filename());
- BOOST_TEST_EQUAL("custom.out1" , c.custom_output_1_filename());
- BOOST_TEST_EQUAL("skin.xrc" , c.skin_filename());
+ LMI_TEST_EQUAL("[renamed]" , c.custom_input_0_filename());
+ LMI_TEST_EQUAL("custom.inix" , c.custom_input_1_filename());
+ LMI_TEST_EQUAL("[renamed]" , c.custom_output_0_filename());
+ LMI_TEST_EQUAL("custom.out1" , c.custom_output_1_filename());
+ LMI_TEST_EQUAL("skin.xrc" , c.skin_filename());
}
int test_main(int, char*[])
diff --git a/contains_test.cpp b/contains_test.cpp
index 5a1a3b7..54bc454 100644
--- a/contains_test.cpp
+++ b/contains_test.cpp
@@ -70,12 +70,12 @@ void test_contains()
// Strings.
- BOOST_TEST( contains(w, w));
- BOOST_TEST(!contains(w, x));
- BOOST_TEST( contains(w, "eta"));
- BOOST_TEST(!contains(w, "zeta"));
- BOOST_TEST( contains(w, 'e'));
- BOOST_TEST(!contains(w, 'q'));
+ LMI_TEST( contains(w, w));
+ LMI_TEST(!contains(w, x));
+ LMI_TEST( contains(w, "eta"));
+ LMI_TEST(!contains(w, "zeta"));
+ LMI_TEST( contains(w, 'e'));
+ LMI_TEST(!contains(w, 'q'));
// Associative containers.
@@ -85,29 +85,29 @@ void test_contains()
,"fortibus es"
,"in ero"
};
- BOOST_TEST( contains(s, "si ergo" ));
- BOOST_TEST(!contains(s, "fortibus"));
+ LMI_TEST( contains(s, "si ergo" ));
+ LMI_TEST(!contains(s, "fortibus"));
std::map<std::string,std::string> const m
{{"O Nobili", "demis trux"}
,{"uatis inem", "causendux"}
};
- BOOST_TEST( contains(m, "uatis inem" ));
- BOOST_TEST(!contains(m, "cows and ducks"));
+ LMI_TEST( contains(m, "uatis inem" ));
+ LMI_TEST(!contains(m, "cows and ducks"));
// Sequences.
std::deque<double> const d(1, 3.14);
- BOOST_TEST( contains(d, 3.14));
- BOOST_TEST(!contains(d, 0.00));
+ LMI_TEST( contains(d, 3.14));
+ LMI_TEST(!contains(d, 0.00));
std::list<double> const t(1, 3.14);
- BOOST_TEST( contains(t, 3.14));
- BOOST_TEST(!contains(t, 0.00));
+ LMI_TEST( contains(t, 3.14));
+ LMI_TEST(!contains(t, 0.00));
std::vector<double> const v(1, 3.14);
- BOOST_TEST( contains(v, 3.14));
- BOOST_TEST(!contains(v, 0.00));
+ LMI_TEST( contains(v, 3.14));
+ LMI_TEST(!contains(v, 0.00));
}
int test_main(int, char*[])
diff --git a/crc32_test.cpp b/crc32_test.cpp
index ffce425..a74d82c 100644
--- a/crc32_test.cpp
+++ b/crc32_test.cpp
@@ -36,7 +36,7 @@ int test_main(int, char*[])
crc += std::string("pippo");
- BOOST_TEST_EQUAL(0x0df1dc234, crc.value());
+ LMI_TEST_EQUAL(0x0df1dc234, crc.value());
return EXIT_SUCCESS;
}
diff --git a/currency_test.cpp b/currency_test.cpp
index baa3c31..1d109ae 100644
--- a/currency_test.cpp
+++ b/currency_test.cpp
@@ -94,30 +94,30 @@ void currency_test::test_default_ctor()
{
// default ctor
currency const a0;
- BOOST_TEST(0.00 == a0.d());
- BOOST_TEST( 0 == a0.m_);
+ LMI_TEST(0.00 == a0.d());
+ LMI_TEST( 0 == a0.m_);
constexpr currency zero {};
- BOOST_TEST( 0 == a0.m_);
+ LMI_TEST( 0 == a0.m_);
}
void currency_test::test_copy_ctor()
{
currency const a1(325, raw_cents{});
currency const copy0 = a1;
- BOOST_TEST_EQUAL( 325, copy0.m_);
+ LMI_TEST_EQUAL( 325, copy0.m_);
currency const copy1 {a1};
- BOOST_TEST_EQUAL( 325, copy1.m_);
+ LMI_TEST_EQUAL( 325, copy1.m_);
}
void currency_test::test_explicit_ctor()
{
currency const a1(325, raw_cents{});
- BOOST_TEST_EQUAL( 325, a1.m_);
+ LMI_TEST_EQUAL( 325, a1.m_);
#if defined DETECT_NONINTEGRAL_CENTS
// 1/64 is an exact binary constant, so 100/64 cents could be
// converted to 1/64 dollars and back without loss of precision;
// but that's outside the intended scope of the currency class.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
((currency {1.5625, raw_cents {}})
,std::runtime_error
,"Nonintegral cents."
@@ -131,74 +131,74 @@ void currency_test::test_negation()
-a1;
// make sure that didn't mutate the object
// (making negation a nonmember makes that mistake less likely)
- BOOST_TEST_EQUAL( 321, a1.m_);
- BOOST_TEST_EQUAL(-321, (-a1).m_);
+ LMI_TEST_EQUAL( 321, a1.m_);
+ LMI_TEST_EQUAL(-321, (-a1).m_);
currency const a2 = -a1;
- BOOST_TEST_EQUAL(-321, a2.m_);
+ LMI_TEST_EQUAL(-321, a2.m_);
}
void currency_test::test_plus_or_minus_eq()
{
currency a1(325, raw_cents{});
a1 += a1;
- BOOST_TEST_EQUAL( 650, a1.m_);
+ LMI_TEST_EQUAL( 650, a1.m_);
a1 -= currency {123, raw_cents {}};
- BOOST_TEST_EQUAL(527, a1.m_);
+ LMI_TEST_EQUAL(527, a1.m_);
}
void currency_test::test_plus_or_minus()
{
currency const a1(650, raw_cents{});
currency a2 = currency() + a1 + a1;
- BOOST_TEST_EQUAL(13.00, a2.d());
- BOOST_TEST_EQUAL( 1300, a2.m_);
+ LMI_TEST_EQUAL(13.00, a2.d());
+ LMI_TEST_EQUAL( 1300, a2.m_);
a2 = currency() - a1;
- BOOST_TEST_EQUAL(-6.50, a2.d());
- BOOST_TEST_EQUAL( -650, a2.m_);
+ LMI_TEST_EQUAL(-6.50, a2.d());
+ LMI_TEST_EQUAL( -650, a2.m_);
a2 = C0 - a1;
- BOOST_TEST_EQUAL(-6.50, a2.d());
- BOOST_TEST_EQUAL( -650, a2.m_);
+ LMI_TEST_EQUAL(-6.50, a2.d());
+ LMI_TEST_EQUAL( -650, a2.m_);
}
void currency_test::test_multiply_by_int()
{
// currency * int returns currency
currency const mult2 {3125, raw_cents {}};
- BOOST_TEST_EQUAL(1000.0, (32 * mult2).d());
- BOOST_TEST_EQUAL(1000.0, dblize(32 * mult2));
- BOOST_TEST_EQUAL(100000, (mult2 * 32).m_);
+ LMI_TEST_EQUAL(1000.0, (32 * mult2).d());
+ LMI_TEST_EQUAL(1000.0, dblize(32 * mult2));
+ LMI_TEST_EQUAL(100000, (mult2 * 32).m_);
}
void currency_test::test_multiply_by_double()
{
currency const mult2 {3125, raw_cents {}};
// currency * double returns double
- BOOST_TEST_EQUAL(1000.0, 32.0 * mult2);
- BOOST_TEST_EQUAL(1000.0, mult2 * 32.0);
+ LMI_TEST_EQUAL(1000.0, 32.0 * mult2);
+ LMI_TEST_EQUAL(1000.0, mult2 * 32.0);
}
void currency_test::test_divide_by_double()
{
// currency / double returns double
currency const div2 {3300, raw_cents {}};
- BOOST_TEST_EQUAL(1.0, div2 / 33);
+ LMI_TEST_EQUAL(1.0, div2 / 33);
}
void currency_test::test_relops()
{
currency const a0;
currency const a1(1728, raw_cents{});
- BOOST_TEST( C0 == a0);
- BOOST_TEST( a1 == a1);
- BOOST_TEST( a0 < a1);
- BOOST_TEST( a0 <= a1);
- BOOST_TEST( a1 <= a1);
- BOOST_TEST( a1 > a0);
- BOOST_TEST( a1 >= a0);
- BOOST_TEST( a1 >= a1);
+ LMI_TEST( C0 == a0);
+ LMI_TEST( a1 == a1);
+ LMI_TEST( a0 < a1);
+ LMI_TEST( a0 <= a1);
+ LMI_TEST( a1 <= a1);
+ LMI_TEST( a1 > a0);
+ LMI_TEST( a1 >= a0);
+ LMI_TEST( a1 >= a1);
}
void currency_test::test_stream_inserter()
@@ -206,32 +206,32 @@ void currency_test::test_stream_inserter()
currency const a3 {123456, raw_cents {}};
std::ostringstream oss;
oss << a3;
- BOOST_TEST_EQUAL("1234.56", oss.str());
+ LMI_TEST_EQUAL("1234.56", oss.str());
}
void currency_test::test_dollars()
{
currency const a0;
- BOOST_TEST(0.00 == a0.d());
+ LMI_TEST(0.00 == a0.d());
currency const a1(325, raw_cents{});
- BOOST_TEST_EQUAL( 325, a1.m_);
- BOOST_TEST_EQUAL( 325, a1.cents());
+ LMI_TEST_EQUAL( 325, a1.m_);
+ LMI_TEST_EQUAL( 325, a1.cents());
// 3.25 is an exact binary constant
- BOOST_TEST_EQUAL(3.25, a1.d());
+ LMI_TEST_EQUAL(3.25, a1.d());
}
void currency_test::test_round_double()
{
double d0 = 123.99999999999;
currency c0 = round_to_nearest_cent.c(d0);
- BOOST_TEST_EQUAL(12400, c0.m_);
+ LMI_TEST_EQUAL(12400, c0.m_);
double d1 = 1.0 + std::numeric_limits<double>::epsilon();
currency c1 = round_to_nearest_cent.c(d1);
- BOOST_TEST_EQUAL(100, c1.m_);
+ LMI_TEST_EQUAL(100, c1.m_);
double d2 = 1.0 - std::numeric_limits<double>::epsilon();
currency c2 = round_to_nearest_cent.c(d2);
- BOOST_TEST_EQUAL(100, c2.m_);
+ LMI_TEST_EQUAL(100, c2.m_);
}
void currency_test::test_round_currency()
@@ -266,33 +266,33 @@ void currency_test::test_infinite()
// Negative infinity.
currency const c0(-d0, raw_cents{});
- BOOST_TEST_EQUAL(-d0, c0.d());
- BOOST_TEST_EQUAL(-d0, dblize(c0));
+ LMI_TEST_EQUAL(-d0, c0.d());
+ LMI_TEST_EQUAL(-d0, dblize(c0));
// Test with from_cents(arg), which asserts that arg==rint(arg).
// Pedantically speaking, that assertion depends on rint(INF),
// which is implementation-defined, but what other result can
// rint(INF) reasonably return than INF?
currency const c1 = from_cents(-d0);
- BOOST_TEST( c0 == c1);
- BOOST_TEST(c1 < from_cents(1.0e100));
+ LMI_TEST( c0 == c1);
+ LMI_TEST(c1 < from_cents(1.0e100));
// Positive infinity.
currency const c2 = from_cents(d0);
- BOOST_TEST_EQUAL(d0, c2.d());
- BOOST_TEST_EQUAL(d0, dblize(c2));
+ LMI_TEST_EQUAL(d0, c2.d());
+ LMI_TEST_EQUAL(d0, dblize(c2));
- BOOST_TEST(-c0 == c2);
- BOOST_TEST( c0 == -c2);
- BOOST_TEST(from_cents(1.0e100) < c2);
+ LMI_TEST(-c0 == c2);
+ LMI_TEST( c0 == -c2);
+ LMI_TEST(from_cents(1.0e100) < c2);
std::ostringstream oss;
oss << c1;
- BOOST_TEST_EQUAL("-inf", oss.str());
+ LMI_TEST_EQUAL("-inf", oss.str());
oss.str("");
oss.clear();
oss << c2;
- BOOST_TEST_EQUAL("inf", oss.str());
+ LMI_TEST_EQUAL("inf", oss.str());
// Often lmi uses an identity element for std::min or std::max.
// For example, a monthly charge might apply only to amounts up
@@ -314,13 +314,13 @@ void currency_test::test_infinite()
void currency_test::test_quodlibet()
{
currency const a0(325, raw_cents{});
- BOOST_TEST_EQUAL(3.25, a0.d());
- BOOST_TEST_EQUAL(3.25, dblize(a0));
+ LMI_TEST_EQUAL(3.25, a0.d());
+ LMI_TEST_EQUAL(3.25, dblize(a0));
currency a1(475, raw_cents{});
- BOOST_TEST_EQUAL(4.75, a1.d());
- BOOST_TEST_EQUAL(4.75, dblize(a1));
+ LMI_TEST_EQUAL(4.75, a1.d());
+ LMI_TEST_EQUAL(4.75, dblize(a1));
currency const a2 = from_cents(125);
- BOOST_TEST_EQUAL(1.25, dblize(a2));
+ LMI_TEST_EQUAL(1.25, dblize(a2));
currency b0 = round_to_nearest_cent.c(464.180000000000006821);
currency b1 = round_to_nearest_cent.c(263.01999999999998181);
@@ -328,8 +328,8 @@ void currency_test::test_quodlibet()
b2 += b0;
b2 += b1;
currency b3 = b0 + b1;
- BOOST_TEST_EQUAL(b2.cents(), b3.cents());
- BOOST_TEST_EQUAL(b2, b3);
+ LMI_TEST_EQUAL(b2.cents(), b3.cents());
+ LMI_TEST_EQUAL(b2, b3);
}
// CURRENCY !! Ideas for testing overflow or underflow.
@@ -337,23 +337,23 @@ void currency_test::test_quodlibet()
// double big_num = nonstd::power(2.0, 53);
double big_num = 1.0e100;
currency::data_type big_int1 = 1.0 * big_num;
- BOOST_TEST_EQUAL(1.0e100, big_int1);
+ LMI_TEST_EQUAL(1.0e100, big_int1);
currency::data_type big_int2 = 10.0 * big_num;
- BOOST_TEST_EQUAL(1.0e101, big_int2);
+ LMI_TEST_EQUAL(1.0e101, big_int2);
currency::data_type big_int3 = 100.0 * big_num;
- BOOST_TEST_EQUAL(1.0e102, big_int3);
+ LMI_TEST_EQUAL(1.0e102, big_int3);
round_to_nearest_cent.c(d0);
std::cout << std::fixed;
std::cout << big_int3 << '\n' << 1.0e102 << '\n' << big_int3 - 1.0e102 <<
std::endl;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(round_to_nearest_cent.c(big_num / 1000.0)
,std::runtime_error
,"Cast would transgress upper limit."
);
double too_big = std::numeric_limits<double>::max();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(round_to_nearest_cent.c(too_big)
,std::runtime_error
// ,"Cast would transgress upper limit."
diff --git a/dbo_rules_test.cpp b/dbo_rules_test.cpp
index 68b2fde..1714fd5 100644
--- a/dbo_rules_test.cpp
+++ b/dbo_rules_test.cpp
@@ -32,31 +32,31 @@
int test_main(int, char*[])
{
- BOOST_TEST( dbo_at_issue_is_allowed(mce_dbopt("A" )));
- BOOST_TEST( dbo_at_issue_is_allowed(mce_dbopt("B" )));
- BOOST_TEST(!dbo_at_issue_is_allowed(mce_dbopt("ROP")));
- BOOST_TEST( dbo_at_issue_is_allowed(mce_dbopt("MDB")));
+ LMI_TEST( dbo_at_issue_is_allowed(mce_dbopt("A" )));
+ LMI_TEST( dbo_at_issue_is_allowed(mce_dbopt("B" )));
+ LMI_TEST(!dbo_at_issue_is_allowed(mce_dbopt("ROP")));
+ LMI_TEST( dbo_at_issue_is_allowed(mce_dbopt("MDB")));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("A" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("B" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("ROP")));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("MDB")));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("A" )));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("B" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("ROP")));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("MDB")));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("A" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("B" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("ROP")));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("MDB")));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("A" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("B" )));
- BOOST_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("ROP")));
- BOOST_TEST( dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("MDB")));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("A" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("B" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("ROP")));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("A" ), mce_dbopt("MDB")));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("A" )));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("B" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("ROP")));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("B" ), mce_dbopt("MDB")));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("A" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("B" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("ROP")));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("ROP"), mce_dbopt("MDB")));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("A" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("B" )));
+ LMI_TEST(!dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("ROP")));
+ LMI_TEST( dbo_transition_is_allowed(mce_dbopt("MDB"), mce_dbopt("MDB")));
{
std::vector<mce_dbopt> v = {};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(dbo_sequence_is_allowed(v)
,std::runtime_error
,"DBO must not be empty."
@@ -65,12 +65,12 @@ int test_main(int, char*[])
{
std::vector<mce_dbopt> v = {mce_dbopt("MDB")};
- BOOST_TEST(dbo_sequence_is_allowed(v));
+ LMI_TEST(dbo_sequence_is_allowed(v));
}
{
std::vector<mce_dbopt> v = {mce_dbopt("ROP")};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(dbo_sequence_is_allowed(v)
,std::runtime_error
,"Forbidden initial DBO 'ROP'."
@@ -83,7 +83,7 @@ int test_main(int, char*[])
,mce_dbopt("A")
,mce_dbopt("MDB")
};
- BOOST_TEST(dbo_sequence_is_allowed(v));
+ LMI_TEST(dbo_sequence_is_allowed(v));
}
{
@@ -91,7 +91,7 @@ int test_main(int, char*[])
{mce_dbopt("A")
,mce_dbopt("B")
};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(dbo_sequence_is_allowed(v)
,std::runtime_error
,"Forbidden DBO change from 'A' to 'B' after 1 years."
@@ -110,7 +110,7 @@ int test_main(int, char*[])
,mce_dbopt("ROP")
,mce_dbopt("MDB")
};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(dbo_sequence_is_allowed(v)
,std::runtime_error
,"Forbidden DBO change from 'MDB' to 'ROP' after 7 years."
diff --git a/dbvalue.cpp b/dbvalue.cpp
index 22127dc..56d3856 100644
--- a/dbvalue.cpp
+++ b/dbvalue.cpp
@@ -115,7 +115,7 @@ database_entity::database_entity
/// ,dims_stat
/// ,stat
/// );
-/// BOOST_TEST_THROW
+/// LMI_TEST_THROW
/// (db.query(DB_MaturityAge)
/// ,std::runtime_error
/// ,"Assertion '1 == v.extent()' failed."
diff --git a/et_vector_0_test.cpp b/et_vector_0_test.cpp
index 23f0602..17d2230 100644
--- a/et_vector_0_test.cpp
+++ b/et_vector_0_test.cpp
@@ -31,7 +31,7 @@ int test_main(int, char*[])
std::vector<double> v0 = {0.0, 1.25, 2.5};
v0 *= v0;
std::vector<double> const r0 = {0.0, 1.5625, 6.25};
- BOOST_TEST(r0 == v0);
+ LMI_TEST(r0 == v0);
}
// Test peteCast().
@@ -41,7 +41,7 @@ int test_main(int, char*[])
peteCast(int{}, v0); // Legal, but feckless.
assign(v1, peteCast(int{}, v0));
std::vector<int> const r1 = {0, 1, 2};
- BOOST_TEST(r1 == v1);
+ LMI_TEST(r1 == v1);
}
// Test what used to be called std::unary_function.
@@ -49,7 +49,7 @@ int test_main(int, char*[])
std::vector<double> v0 = {-1.0, 0.0, 3.875};
assign(v0, apply_unary(std::negate<double>(), v0));
std::vector<double> const r0 = {1.0, 0.0, -3.875};
- BOOST_TEST(r0 == v0);
+ LMI_TEST(r0 == v0);
}
// Test what used to be called std::binary_function.
@@ -57,26 +57,26 @@ int test_main(int, char*[])
std::vector<double> v0 = {0.0, -1.5625, -6.25};
assign(v0, apply_binary(std::multiplies<double>(), -1.0, v0));
std::vector<double> const r0 = {0.0, 1.5625, 6.25};
- BOOST_TEST(r0 == v0);
+ LMI_TEST(r0 == v0);
assign(v0, sqrt(v0));
std::vector<double> const r1 = {0.0, 1.25, 2.5};
- BOOST_TEST(r1 == v0);
+ LMI_TEST(r1 == v0);
// Above, scalar -1.0 was LHS; here, it's RHS.
assign(v0, apply_binary(std::multiplies<double>(), v0, -1.0));
std::vector<double> const r2 = {0.0, -1.25, -2.5};
- BOOST_TEST(r2 == v0);
+ LMI_TEST(r2 == v0);
assign(v0, apply_binary(std::multiplies<double>(), v0, v0));
std::vector<double> const r3 = {0.0, 1.5625, 6.25};
- BOOST_TEST(r3 == v0);
+ LMI_TEST(r3 == v0);
// Right-add 100, left-add 10000 .
assign(v0, apply_binary(std::plus<double>(), v0, 100.0));
assign(v0, apply_binary(std::plus<double>(), 10000.0, v0));
std::vector<double> const r4 = {10100.0, 10101.5625, 10106.25};
- BOOST_TEST(r4 == v0);
+ LMI_TEST(r4 == v0);
}
// Test Min() and Max().
@@ -86,15 +86,15 @@ int test_main(int, char*[])
std::vector<double> v4(v2.size());
assign(v4, Max(v2, v3));
std::vector<double> const r0 = {1.875, 2.875, 3.875, 7.75};
- BOOST_TEST(r0 == v4);
+ LMI_TEST(r0 == v4);
assign(v4, Min(v2, v3));
std::vector<double> const r1 = {1.125, 2.25, 3.375, 0.0};
- BOOST_TEST(r1 == v4);
+ LMI_TEST(r1 == v4);
assign(v4, Min(Max(1.25, Min(v2, v3)), 3.125));
std::vector<double> const r2 = {1.25, 2.25, 3.125, 1.25};
- BOOST_TEST(r2 == v4);
+ LMI_TEST(r2 == v4);
}
return 0;
diff --git a/expression_template_0_test.cpp b/expression_template_0_test.cpp
index f88da1d..8624a42 100644
--- a/expression_template_0_test.cpp
+++ b/expression_template_0_test.cpp
@@ -411,24 +411,24 @@ void time_one_array_length(int length)
double const value_omega = omega * value_alpha;
mete_c();
- BOOST_TEST(materially_equal(cv2 [omega], value_omega));
+ LMI_TEST(materially_equal(cv2 [omega], value_omega));
mete_stl_plain();
- BOOST_TEST(materially_equal(sv2a[omega], value_omega));
+ LMI_TEST(materially_equal(sv2a[omega], value_omega));
mete_stl_fancy();
- BOOST_TEST(materially_equal(sv2b[omega], value_omega));
+ LMI_TEST(materially_equal(sv2b[omega], value_omega));
mete_valarray();
- BOOST_TEST(materially_equal(va2 [omega], value_omega));
+ LMI_TEST(materially_equal(va2 [omega], value_omega));
#if defined USE_UBLAS
mete_ublas();
- BOOST_TEST(materially_equal(ub2 [omega], value_omega));
+ LMI_TEST(materially_equal(ub2 [omega], value_omega));
#endif // defined USE_UBLAS
mete_pete();
- BOOST_TEST(materially_equal(pv2[omega], value_omega));
+ LMI_TEST(materially_equal(pv2[omega], value_omega));
run_one_test("C ", mete_c );
run_one_test("STL plain ", mete_stl_plain);
@@ -486,24 +486,24 @@ void test_pete_assignment()
// With the operator<<() above, this:
std::vector<double> v7a(v0.size());
assign(v7a, v0 - v1);
- BOOST_TEST(v2 == v7a);
+ LMI_TEST(v2 == v7a);
// could be written thus:
std::vector<double> v7b(v0.size());
v7b << v0 - v1;
- BOOST_TEST(v2 == v7b);
+ LMI_TEST(v2 == v7b);
// though these still wouldn't compile:
// std::vector<double> v7c << v0 - v1;
// std::vector<double> v7d(v0 - v1);
// and, although this compiles:
std::vector<double> v7e; v7e << v0 - v1;
// it doesn't do what one might hope--instead, the vector is empty:
- BOOST_TEST(0 == v7e.size());
+ LMI_TEST(0 == v7e.size());
// On the other hand, this syntax is almost natural, even though it's
// silly to add zero to everything.
std::vector<double> v7f(v0.size());
v7f += v0 - v1;
- BOOST_TEST(v2 == v7f);
+ LMI_TEST(v2 == v7f);
// But that may be the best that can easily be done with PETE: where
// std::vector<double> v7f += v0 - v1;
// is wanted, instead write
diff --git a/fenv_lmi_test.cpp b/fenv_lmi_test.cpp
index fa7a82c..3f27dc9 100644
--- a/fenv_lmi_test.cpp
+++ b/fenv_lmi_test.cpp
@@ -51,7 +51,7 @@ std::bitset<CHAR_BIT * sizeof(std::uint32_t)>
bits(std::uint32_t i)
}
#if defined LMI_X87
-# define BOOST_TEST_EQUAL_BITS(a,b) \
+# define LMI_TEST_EQUAL_BITS(a,b) \
if((a) == (b)) \
lmi_test::record_success(); \
else \
@@ -60,7 +60,7 @@ std::bitset<CHAR_BIT * sizeof(std::uint32_t)>
bits(std::uint32_t i)
lmi_test::error_stream() << "Unequal:"; \
lmi_test::error_stream() << bits(a); \
lmi_test::error_stream() << bits(b); \
- lmi_test::error_stream() << BOOST_TEST_FLUSH; \
+ lmi_test::error_stream() << LMI_TEST_FLUSH; \
} \
#endif // defined LMI_X87
@@ -70,24 +70,24 @@ int test_main(int, char*[])
#if defined LMI_X87
std::uint16_t cw = 0x0000;
- BOOST_TEST_EQUAL_BITS(0x037f, msvc_to_intel(0x0008001f));
+ LMI_TEST_EQUAL_BITS(0x037f, msvc_to_intel(0x0008001f));
- BOOST_TEST_EQUAL_BITS(0x0008001f, intel_to_msvc(0x037f));
+ LMI_TEST_EQUAL_BITS(0x0008001f, intel_to_msvc(0x037f));
cw = 0x037f;
- BOOST_TEST_EQUAL_BITS(0x0008001f, intel_to_msvc(cw));
- BOOST_TEST_EQUAL_BITS(cw, msvc_to_intel(0x0008001f));
- BOOST_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
+ LMI_TEST_EQUAL_BITS(0x0008001f, intel_to_msvc(cw));
+ LMI_TEST_EQUAL_BITS(cw, msvc_to_intel(0x0008001f));
+ LMI_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
cw = 0x027f;
- BOOST_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
+ LMI_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
cw = 0x037f;
- BOOST_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
+ LMI_TEST_EQUAL_BITS(cw, msvc_to_intel(intel_to_msvc(cw)));
// Most reserved bits should be left as initialized by FINIT...
x87_control_word(0x0000);
- BOOST_TEST_EQUAL_BITS(0x0040, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x0040, x87_control_word());
// ...but bit 12, the deprecated IC, remains settable.
x87_control_word
@@ -96,7 +96,7 @@ int test_main(int, char*[])
)
);
- BOOST_TEST_EQUAL_BITS
+ LMI_TEST_EQUAL_BITS
(intel_control_word_parameters::reserved_values
,~0x01000UL & x87_control_word()
);
@@ -110,7 +110,7 @@ int test_main(int, char*[])
intel_control_word invalid_intel_control_word(0);
invalid_intel_control_word.pc(e_x87_precision (0x01));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(msvc_control_word msvc_error (invalid_intel_control_word)
,std::logic_error
,"Invalid fpu PC value."
@@ -118,34 +118,34 @@ int test_main(int, char*[])
msvc_control_word invalid_msvc_control_word (0);
invalid_msvc_control_word.pc (e_msvc_precision(0x03));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(intel_control_word intel_error(invalid_msvc_control_word )
,std::logic_error
,"Invalid fpu PC value."
);
x87_control_word(0x027f);
- BOOST_TEST_EQUAL_BITS(0x027f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x027f, x87_control_word());
x87_control_word(0x037f);
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
x87_control_word(default_x87_control_word());
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
fenv_initialize();
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
# if defined __MINGW32__
// Test the C99 method, as extended by MinGW.
- BOOST_TEST_EQUAL(0, std::fesetenv(FE_PC53_ENV));
- BOOST_TEST_EQUAL_BITS(0x027f, x87_control_word());
+ LMI_TEST_EQUAL(0, std::fesetenv(FE_PC53_ENV));
+ LMI_TEST_EQUAL_BITS(0x027f, x87_control_word());
- BOOST_TEST_EQUAL(0, std::fesetenv(FE_PC64_ENV));
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL(0, std::fesetenv(FE_PC64_ENV));
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
- BOOST_TEST_EQUAL(0, std::fesetenv(FE_DFL_ENV));
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL(0, std::fesetenv(FE_DFL_ENV));
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
# endif // defined __MINGW32__
# if defined _MCW_EM
@@ -154,7 +154,7 @@ int test_main(int, char*[])
_control87(_MCW_EM, _MCW_EM);
_control87(_RC_NEAR, _MCW_RC);
_control87(_PC_64, _MCW_PC);
- BOOST_TEST_EQUAL_BITS(0x037f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x037f, x87_control_word());
# endif // defined _MCW_EM
// Test precision and rounding control. These spotchecks are
@@ -162,11 +162,11 @@ int test_main(int, char*[])
fenv_initialize();
fenv_precision(fe_dblprec);
- BOOST_TEST_EQUAL_BITS(0x027f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x027f, x87_control_word());
fenv_initialize();
fenv_rounding(fe_towardzero);
- BOOST_TEST_EQUAL_BITS(0x0f7f, x87_control_word());
+ LMI_TEST_EQUAL_BITS(0x0f7f, x87_control_word());
#endif // defined LMI_X87
@@ -174,13 +174,13 @@ int test_main(int, char*[])
#if defined LMI_X87
fenv_precision (fe_fltprec);
- BOOST_TEST_EQUAL(fe_fltprec , fenv_precision());
+ LMI_TEST_EQUAL(fe_fltprec , fenv_precision());
fenv_precision (fe_dblprec);
- BOOST_TEST_EQUAL(fe_dblprec , fenv_precision());
+ LMI_TEST_EQUAL(fe_dblprec , fenv_precision());
fenv_precision (fe_ldblprec);
- BOOST_TEST_EQUAL(fe_ldblprec, fenv_precision());
+ LMI_TEST_EQUAL(fe_ldblprec, fenv_precision());
#endif // defined LMI_X87
// Test rounding control.
@@ -189,35 +189,35 @@ int test_main(int, char*[])
// fenv_rounding (99999);
fenv_rounding (fe_tonearest);
- BOOST_TEST_EQUAL(fe_tonearest , fenv_rounding());
- BOOST_TEST_EQUAL(-2, std::rint(-2.5));
- BOOST_TEST_EQUAL(-2, std::rint(-1.5));
- BOOST_TEST_EQUAL( 2, std::rint( 1.5));
- BOOST_TEST_EQUAL( 2, std::rint( 2.5));
+ LMI_TEST_EQUAL(fe_tonearest , fenv_rounding());
+ LMI_TEST_EQUAL(-2, std::rint(-2.5));
+ LMI_TEST_EQUAL(-2, std::rint(-1.5));
+ LMI_TEST_EQUAL( 2, std::rint( 1.5));
+ LMI_TEST_EQUAL( 2, std::rint( 2.5));
fenv_rounding (fe_downward);
- BOOST_TEST_EQUAL(fe_downward , fenv_rounding());
- BOOST_TEST_EQUAL(-3, std::rint(-2.5));
- BOOST_TEST_EQUAL(-2, std::rint(-1.5));
- BOOST_TEST_EQUAL( 1, std::rint( 1.5));
- BOOST_TEST_EQUAL( 2, std::rint( 2.5));
+ LMI_TEST_EQUAL(fe_downward , fenv_rounding());
+ LMI_TEST_EQUAL(-3, std::rint(-2.5));
+ LMI_TEST_EQUAL(-2, std::rint(-1.5));
+ LMI_TEST_EQUAL( 1, std::rint( 1.5));
+ LMI_TEST_EQUAL( 2, std::rint( 2.5));
fenv_rounding (fe_upward);
- BOOST_TEST_EQUAL(fe_upward , fenv_rounding());
- BOOST_TEST_EQUAL(-2, std::rint(-2.5));
- BOOST_TEST_EQUAL(-1, std::rint(-1.5));
- BOOST_TEST_EQUAL( 2, std::rint( 1.5));
- BOOST_TEST_EQUAL( 3, std::rint( 2.5));
+ LMI_TEST_EQUAL(fe_upward , fenv_rounding());
+ LMI_TEST_EQUAL(-2, std::rint(-2.5));
+ LMI_TEST_EQUAL(-1, std::rint(-1.5));
+ LMI_TEST_EQUAL( 2, std::rint( 1.5));
+ LMI_TEST_EQUAL( 3, std::rint( 2.5));
fenv_rounding (fe_towardzero);
- BOOST_TEST_EQUAL(fe_towardzero, fenv_rounding());
- BOOST_TEST_EQUAL(-2, std::rint(-2.5));
- BOOST_TEST_EQUAL(-1, std::rint(-1.5));
- BOOST_TEST_EQUAL( 1, std::rint( 1.5));
- BOOST_TEST_EQUAL( 2, std::rint( 2.5));
+ LMI_TEST_EQUAL(fe_towardzero, fenv_rounding());
+ LMI_TEST_EQUAL(-2, std::rint(-2.5));
+ LMI_TEST_EQUAL(-1, std::rint(-1.5));
+ LMI_TEST_EQUAL( 1, std::rint( 1.5));
+ LMI_TEST_EQUAL( 2, std::rint( 2.5));
fenv_initialize();
- BOOST_TEST(fenv_validate());
+ LMI_TEST(fenv_validate());
#if defined LMI_X87
std::cout
@@ -228,40 +228,40 @@ int test_main(int, char*[])
fenv_initialize();
fenv_precision(fe_dblprec);
- BOOST_TEST(fenv_validate(e_fenv_indulge_0x027f));
- BOOST_TEST(fenv_validate());
+ LMI_TEST(fenv_validate(e_fenv_indulge_0x027f));
+ LMI_TEST(fenv_validate());
std::cout << "\n[Expect an induced '0x007f' warning...\n" << std::endl;
fenv_precision(fe_fltprec);
- BOOST_TEST(!fenv_validate());
+ LMI_TEST(!fenv_validate());
std::cout << "...end of induced warning]." << std::endl;
- BOOST_TEST(fenv_validate());
+ LMI_TEST(fenv_validate());
std::cout << "\n[Expect an induced '0x007f' warning...\n" << std::endl;
fenv_precision(fe_fltprec);
- BOOST_TEST(!fenv_validate(e_fenv_indulge_0x027f));
+ LMI_TEST(!fenv_validate(e_fenv_indulge_0x027f));
std::cout << "...end of induced warning]." << std::endl;
- BOOST_TEST(fenv_validate());
+ LMI_TEST(fenv_validate());
- BOOST_TEST(0 == fenv_guard::instance_count());
+ LMI_TEST(0 == fenv_guard::instance_count());
fenv_precision(fe_fltprec);
{
fenv_guard fg;
- BOOST_TEST(1 == fenv_guard::instance_count());
+ LMI_TEST(1 == fenv_guard::instance_count());
}
- BOOST_TEST(0 == fenv_guard::instance_count());
- BOOST_TEST(fenv_validate());
+ LMI_TEST(0 == fenv_guard::instance_count());
+ LMI_TEST(fenv_validate());
std::cout << "\n[Expect an induced '0x027f' warning...\n" << std::endl;
{
fenv_guard fg;
- BOOST_TEST(1 == fenv_guard::instance_count());
+ LMI_TEST(1 == fenv_guard::instance_count());
fenv_precision(fe_dblprec);
}
- BOOST_TEST(0 == fenv_guard::instance_count());
+ LMI_TEST(0 == fenv_guard::instance_count());
std::cout << "...end of induced warning]." << std::endl;
- BOOST_TEST(fenv_validate());
+ LMI_TEST(fenv_validate());
#endif // defined LMI_X87
return 0;
diff --git a/file_command_test.cpp b/file_command_test.cpp
index 9cca7d1..b037b9d 100644
--- a/file_command_test.cpp
+++ b/file_command_test.cpp
@@ -27,7 +27,7 @@
int test_main(int, char*[])
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(file_command()("", "")
,std::runtime_error
,"Class 'file_command' not implemented for command-line interface."
diff --git a/financial_test.cpp b/financial_test.cpp
index 7869462..0a5630d 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -45,22 +45,22 @@ int test_main(int, char*[])
// exactly.
irr_helper<double*> xxx(pmts, pmts + 1, bfts[0], 5);
- BOOST_TEST(2.0 == xxx());
+ LMI_TEST(2.0 == xxx());
- BOOST_TEST(( 2.0 == irr_helper<double*>(pmts, pmts + 1, bfts[0], 5)()));
+ LMI_TEST(( 2.0 == irr_helper<double*>(pmts, pmts + 1, bfts[0], 5)()));
- BOOST_TEST(( 2.0 == irr_helper<double*>(pmts, pmts + 3, bfts[2], 5)()));
+ LMI_TEST(( 2.0 == irr_helper<double*>(pmts, pmts + 3, bfts[2], 5)()));
- BOOST_TEST((-1.0 == irr_helper<double*>(pmts, pmts + 3, 0.0 , 5)()));
+ LMI_TEST((-1.0 == irr_helper<double*>(pmts, pmts + 3, 0.0 , 5)()));
// Test with arrays.
double cash_flows[4] = {pmts[0], pmts[1], pmts[2], -bfts[2]};
- BOOST_TEST(2.0 == irr(cash_flows, 4 + cash_flows, 5));
+ LMI_TEST(2.0 == irr(cash_flows, 4 + cash_flows, 5));
// Test with vectors.
std::vector<double> v(cash_flows, 4 + cash_flows);
- BOOST_TEST(2.0 == irr(v.begin(), v.end(), 0.0, 5));
- BOOST_TEST(2.0 == irr(v.begin(), v.end(), 5));
+ LMI_TEST(2.0 == irr(v.begin(), v.end(), 0.0, 5));
+ LMI_TEST(2.0 == irr(v.begin(), v.end(), 5));
std::vector<double> p; // Payments.
std::vector<double> b; // Benefits.
@@ -83,17 +83,17 @@ int test_main(int, char*[])
// Curiously, gnumeric results for durations 7..9 don't match as
// closely as for earlier durations or for later duration 99.
- BOOST_TEST(materially_equal(99.000000000000000, results[ 0]));
- BOOST_TEST(materially_equal(12.177446878757825, results[ 1]));
- BOOST_TEST(materially_equal( 4.955259671231229, results[ 2]));
- BOOST_TEST(materially_equal( 2.868166276393760, results[ 3]));
- BOOST_TEST(materially_equal( 1.947887419010502, results[ 4]));
- BOOST_TEST(materially_equal( 1.446186004776299, results[ 5]));
- BOOST_TEST(materially_equal( 1.135702229722491, results[ 6]));
- BOOST_TEST(materially_equal( 0.926742991091295, results[ 7], 1e-9));
- BOOST_TEST(materially_equal( 0.777508398535212, results[ 8], 1e-9));
- BOOST_TEST(materially_equal( 0.666120736082859, results[ 9], 1e-9));
- BOOST_TEST(materially_equal( 0.017575671480682, results[99]));
+ LMI_TEST(materially_equal(99.000000000000000, results[ 0]));
+ LMI_TEST(materially_equal(12.177446878757825, results[ 1]));
+ LMI_TEST(materially_equal( 4.955259671231229, results[ 2]));
+ LMI_TEST(materially_equal( 2.868166276393760, results[ 3]));
+ LMI_TEST(materially_equal( 1.947887419010502, results[ 4]));
+ LMI_TEST(materially_equal( 1.446186004776299, results[ 5]));
+ LMI_TEST(materially_equal( 1.135702229722491, results[ 6]));
+ LMI_TEST(materially_equal( 0.926742991091295, results[ 7], 1e-9));
+ LMI_TEST(materially_equal( 0.777508398535212, results[ 8], 1e-9));
+ LMI_TEST(materially_equal( 0.666120736082859, results[ 9], 1e-9));
+ LMI_TEST(materially_equal( 0.017575671480682, results[99]));
// For any stream, NPV at the IRR rate should ideally be zero.
std::vector<double> q{p};
@@ -101,10 +101,10 @@ int test_main(int, char*[])
// This NPV is -9.777068044058979E-12 in a gnumeric spreadsheet,
// versus -9.86988e-014 with MinGW-w64 gcc-6.3.0; the 1e-13
// tolerance is simply the materially_equal() default.
- BOOST_TEST(std::fabs(npv(q.begin(), q.end(), results.back())) <= 1e-13);
+ LMI_TEST(std::fabs(npv(q.begin(), q.end(), results.back())) <= 1e-13);
// Trivially, NPV at 0% interest is summation.
- BOOST_TEST(materially_equal(-4950.0L, npv(q.begin(), q.end(), 0.0)));
+ LMI_TEST(materially_equal(-4950.0L, npv(q.begin(), q.end(), 0.0)));
// Test const vectors.
std::vector<double> const cp(p);
@@ -124,30 +124,30 @@ int test_main(int, char*[])
// Test specialized irr() for life insurance, reflecting lapse duration.
irr(p, b, results, p.size(), p.size(), decimals);
- BOOST_TEST(std::fabs(99.00000 - results[ 0]) <= tolerance);
- BOOST_TEST(std::fabs(12.17744 - results[ 1]) <= tolerance);
- BOOST_TEST(std::fabs( 4.95525 - results[ 2]) <= tolerance);
- BOOST_TEST(std::fabs( 2.86816 - results[ 3]) <= tolerance);
- BOOST_TEST(std::fabs( 1.94788 - results[ 4]) <= tolerance);
- BOOST_TEST(std::fabs( 1.44618 - results[ 5]) <= tolerance);
- BOOST_TEST(std::fabs( 1.13570 - results[ 6]) <= tolerance);
- BOOST_TEST(std::fabs( 0.92674 - results[ 7]) <= tolerance);
- BOOST_TEST(std::fabs( 0.77750 - results[ 8]) <= tolerance);
- BOOST_TEST(std::fabs( 0.66612 - results[ 9]) <= tolerance);
- BOOST_TEST(std::fabs( 0.01757 - results[99]) <= tolerance);
+ LMI_TEST(std::fabs(99.00000 - results[ 0]) <= tolerance);
+ LMI_TEST(std::fabs(12.17744 - results[ 1]) <= tolerance);
+ LMI_TEST(std::fabs( 4.95525 - results[ 2]) <= tolerance);
+ LMI_TEST(std::fabs( 2.86816 - results[ 3]) <= tolerance);
+ LMI_TEST(std::fabs( 1.94788 - results[ 4]) <= tolerance);
+ LMI_TEST(std::fabs( 1.44618 - results[ 5]) <= tolerance);
+ LMI_TEST(std::fabs( 1.13570 - results[ 6]) <= tolerance);
+ LMI_TEST(std::fabs( 0.92674 - results[ 7]) <= tolerance);
+ LMI_TEST(std::fabs( 0.77750 - results[ 8]) <= tolerance);
+ LMI_TEST(std::fabs( 0.66612 - results[ 9]) <= tolerance);
+ LMI_TEST(std::fabs( 0.01757 - results[99]) <= tolerance);
irr(p, b, results, 9, p.size(), decimals);
- BOOST_TEST(std::fabs(99.00000 - results[ 0]) <= tolerance);
- BOOST_TEST(std::fabs(12.17744 - results[ 1]) <= tolerance);
- BOOST_TEST(std::fabs( 4.95525 - results[ 2]) <= tolerance);
- BOOST_TEST(std::fabs( 2.86816 - results[ 3]) <= tolerance);
- BOOST_TEST(std::fabs( 1.94788 - results[ 4]) <= tolerance);
- BOOST_TEST(std::fabs( 1.44618 - results[ 5]) <= tolerance);
- BOOST_TEST(std::fabs( 1.13570 - results[ 6]) <= tolerance);
- BOOST_TEST(std::fabs( 0.92674 - results[ 7]) <= tolerance);
- BOOST_TEST(std::fabs( 0.77750 - results[ 8]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 9]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[99]) <= tolerance);
+ LMI_TEST(std::fabs(99.00000 - results[ 0]) <= tolerance);
+ LMI_TEST(std::fabs(12.17744 - results[ 1]) <= tolerance);
+ LMI_TEST(std::fabs( 4.95525 - results[ 2]) <= tolerance);
+ LMI_TEST(std::fabs( 2.86816 - results[ 3]) <= tolerance);
+ LMI_TEST(std::fabs( 1.94788 - results[ 4]) <= tolerance);
+ LMI_TEST(std::fabs( 1.44618 - results[ 5]) <= tolerance);
+ LMI_TEST(std::fabs( 1.13570 - results[ 6]) <= tolerance);
+ LMI_TEST(std::fabs( 0.92674 - results[ 7]) <= tolerance);
+ LMI_TEST(std::fabs( 0.77750 - results[ 8]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 9]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[99]) <= tolerance);
// Test empty payment interval.
@@ -157,17 +157,17 @@ int test_main(int, char*[])
// This version fills 'results' with -100%.
irr(p, b, results, 0, p.size(), decimals);
- BOOST_TEST(std::fabs(-1.00000 - results[ 0]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 1]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 2]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 3]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 4]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 5]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 6]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 7]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 8]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[ 9]) <= tolerance);
- BOOST_TEST(std::fabs(-1.00000 - results[99]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 0]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 1]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 2]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 3]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 4]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 5]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 6]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 7]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 8]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[ 9]) <= tolerance);
+ LMI_TEST(std::fabs(-1.00000 - results[99]) <= tolerance);
// Test nonempty cashflow streams consisting only of zeros.
@@ -178,13 +178,13 @@ int test_main(int, char*[])
// This version leaves 'results' unchanged. Test it to make
// sure it doesn't segfault.
irr(p0.begin(), p0.begin(), b0.begin(), r0.begin(), decimals);
- BOOST_TEST_EQUAL(r0[3], 3.14);
+ LMI_TEST_EQUAL(r0[3], 3.14);
// SOMEDAY !! The zero polynomial has an infinitude of roots,
// but, given that we must return only one, wouldn't some
// value like 0% or -100% be more suitable?
irr(p0, b0, r0, p0.size(), p0.size(), decimals);
- BOOST_TEST_EQUAL(r0[3], 1000);
+ LMI_TEST_EQUAL(r0[3], 1000);
// Test fv().
@@ -206,7 +206,7 @@ int test_main(int, char*[])
{
accum_p[j] = (accum_p[j - 1] + p[j]) * one_plus_i;
}
- BOOST_TEST
+ LMI_TEST
(std::fabs(fv(p.begin(), p.end(), i) - accum_p.back())
<= tolerance
);
diff --git a/getopt_test.cpp b/getopt_test.cpp
index ee355bc..3297b68 100644
--- a/getopt_test.cpp
+++ b/getopt_test.cpp
@@ -206,14 +206,14 @@ int test_main(int, char*[])
char* test_argv[] = {arg0, arg1, arg2, nullptr};
int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
- BOOST_TEST_EQUAL(s, "option verbose\nnon-option ARGV-elements: xyz\n");
+ LMI_TEST_EQUAL(s, "option verbose\nnon-option ARGV-elements: xyz\n");
}
{
char* test_argv[] = {nullptr};
int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
- BOOST_TEST_EQUAL(s, "");
+ LMI_TEST_EQUAL(s, "");
}
{
@@ -223,7 +223,7 @@ int test_main(int, char*[])
char* test_argv[] = {arg0, arg1, arg2, nullptr};
int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
- BOOST_TEST_EQUAL(s, "option o\noption d with value '1,2,3'\n");
+ LMI_TEST_EQUAL(s, "option o\noption d with value '1,2,3'\n");
}
return EXIT_SUCCESS;
diff --git a/global_settings_test.cpp b/global_settings_test.cpp
index 7555959..92cef09 100644
--- a/global_settings_test.cpp
+++ b/global_settings_test.cpp
@@ -43,7 +43,7 @@ void test_directory_exceptions()
// Such string values must not be empty.
// "Data directory must not be empty."
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(global_settings::instance().set_data_directory("")
,std::runtime_error
,""
@@ -51,7 +51,7 @@ void test_directory_exceptions()
// Such string values must be validly-formed paths.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(global_settings::instance().set_data_directory("?")
,std::runtime_error
,""
@@ -60,7 +60,7 @@ void test_directory_exceptions()
// Such string values must name paths that exist in the filesystem.
// "Data directory 'UnLiKeLyNaMe' not found."
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(global_settings::instance().set_data_directory("UnLiKeLyNaMe")
,std::runtime_error
,""
@@ -69,7 +69,7 @@ void test_directory_exceptions()
// Such string values must name directories, not normal files.
// "Data directory 'global_settings.o' is not a directory."
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(global_settings::instance().set_data_directory("global_settings.o")
,std::runtime_error
,""
@@ -93,7 +93,7 @@ int test_main(int, char*[])
fs::directory_iterator i(path);
- BOOST_TEST(exists(*i));
+ LMI_TEST(exists(*i));
// Certain other operations are required to throw.
@@ -103,7 +103,7 @@ int test_main(int, char*[])
// an instance of class global_settings should throw. Test this in
// order to guard against changes to the boost filesystem library.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(fs::path::default_name_check(fs::native)
,fs::filesystem_error
,""
@@ -111,10 +111,10 @@ int test_main(int, char*[])
// 'ash_nazg' implies 'mellon'.
global_settings::instance().set_mellon(false);
- BOOST_TEST(!global_settings::instance().mellon());
+ LMI_TEST(!global_settings::instance().mellon());
global_settings::instance().set_ash_nazg(true);
- BOOST_TEST( global_settings::instance().mellon());
+ LMI_TEST( global_settings::instance().mellon());
return 0;
}
diff --git a/gpt_test.cpp b/gpt_test.cpp
index 7ca60c1..502e45b 100644
--- a/gpt_test.cpp
+++ b/gpt_test.cpp
@@ -337,7 +337,7 @@ void gpt_test::test_preconditions()
// Negative duration.
parms.duration = -1;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(z.calculate_premium(oe_gsp, mce_option1_for_7702, parms)
,std::runtime_error
,""
@@ -346,7 +346,7 @@ void gpt_test::test_preconditions()
// Duration greater than omega minus one.
parms.duration = lmi::ssize(q_m);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(z.calculate_premium(oe_gsp, mce_option1_for_7702, parms)
,std::runtime_error
,""
@@ -356,7 +356,7 @@ void gpt_test::test_preconditions()
// Negative target. (Identical preconditions for other scalar
// parameters are not redundantly tested here.)
parms.target = -0.01;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(z.calculate_premium(oe_gsp, mce_option1_for_7702, parms)
,std::runtime_error
,""
@@ -365,7 +365,7 @@ void gpt_test::test_preconditions()
// Monthly q shorter than other vector parameters.
q_m.resize(99);
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Monthly q equal to unity: probably a bad idea, but permitted.
@@ -375,27 +375,27 @@ void gpt_test::test_preconditions()
// Monthly q greater than unity.
q_m.back() = 1.001;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Negative monthly q.
q_m[0] = -0.001;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Premium load equal to unity.
prem_load_target[0] = 1.0;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Monthly specamt load equal to unity.
specamt_load_monthly[0] = 1.0;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Monthly QAB rate equal to unity.
qab_adb_rate[0] = 1.0;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
// Negative premium loads are trapped. They are known to have been
@@ -403,7 +403,7 @@ void gpt_test::test_preconditions()
// it's not worth the trouble to validate premium calculations
// in advance under rare and questionable circumstances.
prem_load_excess[0] = -0.01;
- BOOST_TEST_THROW(instantiate_cf(), std::runtime_error, "");
+ LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
initialize(0); // Reset.
}
@@ -514,7 +514,7 @@ void gpt_test::compare_premiums(int issue_age, double
target)
&& materially_equal(r1, r1_old)
&& materially_equal(r2, r2_old)
;
- BOOST_TEST(all_materially_equal);
+ LMI_TEST(all_materially_equal);
if(!all_materially_equal)
{
std::cout
@@ -571,11 +571,11 @@ void gpt_test::test_premium_calculations()
&& materially_equal(r1, touchstone[x_plus_t][1])
&& materially_equal(r2, touchstone[x_plus_t][2])
;
- BOOST_TEST(all_materially_equal);
+ LMI_TEST(all_materially_equal);
++count;
}
}
- BOOST_TEST(5050 == count);
+ LMI_TEST(5050 == count);
}
void gpt_test::mete_premiums()
diff --git a/handle_exceptions_test.cpp b/handle_exceptions_test.cpp
index 045e243..851e692 100644
--- a/handle_exceptions_test.cpp
+++ b/handle_exceptions_test.cpp
@@ -51,7 +51,7 @@ int test_main(int, char*[])
catch(...)
{
report_exception();
- BOOST_TEST(true);
+ LMI_TEST(true);
}
// Test the
@@ -68,12 +68,12 @@ int test_main(int, char*[])
try
{
report_exception(); // Should rethrow.
- BOOST_TEST(false);
+ LMI_TEST(false);
}
catch(...)
{
std::cout << "...Success: caught elusive exception." << std::endl;
- BOOST_TEST(true);
+ LMI_TEST(true);
}
}
diff --git a/ieee754_test.cpp b/ieee754_test.cpp
index 4315514..00f21bf 100644
--- a/ieee754_test.cpp
+++ b/ieee754_test.cpp
@@ -29,36 +29,36 @@
int test_main(int, char*[])
{
- BOOST_TEST(is_infinite(infinity<float >()));
- BOOST_TEST(is_infinite(infinity<double >()));
- BOOST_TEST(is_infinite(infinity<long double>()));
+ LMI_TEST(is_infinite(infinity<float >()));
+ LMI_TEST(is_infinite(infinity<double >()));
+ LMI_TEST(is_infinite(infinity<long double>()));
// Narrowing conversions commented out here:
- BOOST_TEST(is_infinite<float >(-infinity<float >()));
-// BOOST_TEST(is_infinite<float >(-infinity<double >()));
-// BOOST_TEST(is_infinite<float >(-infinity<long double>()));
- BOOST_TEST(is_infinite<double >(-infinity<float >()));
- BOOST_TEST(is_infinite<double >(-infinity<double >()));
-// BOOST_TEST(is_infinite<double >(-infinity<long double>()));
- BOOST_TEST(is_infinite<long double>(-infinity<float >()));
- BOOST_TEST(is_infinite<long double>(-infinity<double >()));
- BOOST_TEST(is_infinite<long double>(-infinity<long double>()));
+ LMI_TEST(is_infinite<float >(-infinity<float >()));
+// LMI_TEST(is_infinite<float >(-infinity<double >()));
+// LMI_TEST(is_infinite<float >(-infinity<long double>()));
+ LMI_TEST(is_infinite<double >(-infinity<float >()));
+ LMI_TEST(is_infinite<double >(-infinity<double >()));
+// LMI_TEST(is_infinite<double >(-infinity<long double>()));
+ LMI_TEST(is_infinite<long double>(-infinity<float >()));
+ LMI_TEST(is_infinite<long double>(-infinity<double >()));
+ LMI_TEST(is_infinite<long double>(-infinity<long double>()));
// Narrowing conversions tested here:
#if defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wfloat-conversion"
#endif // defined __GNUC__
- BOOST_TEST(is_infinite<float >(-infinity<double >()));
- BOOST_TEST(is_infinite<float >(-infinity<long double>()));
- BOOST_TEST(is_infinite<double >(-infinity<long double>()));
+ LMI_TEST(is_infinite<float >(-infinity<double >()));
+ LMI_TEST(is_infinite<float >(-infinity<long double>()));
+ LMI_TEST(is_infinite<double >(-infinity<long double>()));
#if defined __GNUC__
# pragma GCC diagnostic pop
#endif // defined __GNUC__
- BOOST_TEST(!is_infinite(0.0));
- BOOST_TEST(!is_infinite( std::numeric_limits<double>::max()));
- BOOST_TEST(!is_infinite(-std::numeric_limits<double>::max()));
+ LMI_TEST(!is_infinite(0.0));
+ LMI_TEST(!is_infinite( std::numeric_limits<double>::max()));
+ LMI_TEST(!is_infinite(-std::numeric_limits<double>::max()));
if(std::numeric_limits<double>::has_quiet_NaN)
{
@@ -74,11 +74,11 @@ int test_main(int, char*[])
long double z = implausible_value<long double>();
bool xx = x == x;
- BOOST_TEST(!xx);
+ LMI_TEST(!xx);
bool yy = y == y;
- BOOST_TEST(!yy);
+ LMI_TEST(!yy);
bool zz = z == z;
- BOOST_TEST(!zz);
+ LMI_TEST(!zz);
return 0;
}
diff --git a/input_sequence_test.cpp b/input_sequence_test.cpp
index 49bf015..f77c048 100644
--- a/input_sequence_test.cpp
+++ b/input_sequence_test.cpp
@@ -119,7 +119,7 @@ void input_sequence_test::check
std::cout << std::endl;
}
- INVOKE_BOOST_TEST(bv && bs && bf && bh, file, line);
+ INVOKE_LMI_TEST(bv && bs && bf && bh, file, line);
}
catch(std::exception const& x)
{
@@ -137,7 +137,7 @@ void input_sequence_test::check
<< std::endl
;
}
- INVOKE_BOOST_TEST(b, file, line);
+ INVOKE_LMI_TEST(b, file, line);
}
catch(...)
{
@@ -309,7 +309,7 @@ void input_sequence_test::test()
" Current token ';' at position 29.\n"
;
check(__FILE__, __LINE__, n, d, e, g, m);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Interval [ 0, 0 ) is improper: it ends before it begins."
,abridge_diagnostics(m)
);
@@ -331,7 +331,7 @@ void input_sequence_test::test()
" Current token ';' at position 32.\n"
;
check(__FILE__, __LINE__, n, d, e, g, m);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Interval [ 3, 1 ) is improper: it ends before it begins."
,abridge_diagnostics(m)
);
@@ -373,7 +373,7 @@ void input_sequence_test::test()
" current interval [ 2, 5 ) would begin before that."
;
check(__FILE__, __LINE__, n, d, e, g, m);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(std::string(m)
,abridge_diagnostics(m)
);
@@ -405,16 +405,16 @@ void input_sequence_test::test()
{
std::vector<double> const v{1, 1, 1, 2, 2};
InputSequence const seq(v);
- BOOST_TEST(v == seq.seriatim_numbers());
- BOOST_TEST_EQUAL("1 3; 2", canonicalized_input_sequence(v));
+ LMI_TEST(v == seq.seriatim_numbers());
+ LMI_TEST_EQUAL("1 3; 2", canonicalized_input_sequence(v));
}
// Test construction from string (keyword) vector.
{
std::vector<std::string> const v{"alpha", "beta", "beta", "gamma", "eta"};
InputSequence const seq(v);
- BOOST_TEST(v == seq.seriatim_keywords());
- BOOST_TEST_EQUAL
+ LMI_TEST(v == seq.seriatim_keywords());
+ LMI_TEST_EQUAL
("alpha; beta 3; gamma; eta"
,canonicalized_input_sequence(v)
);
@@ -424,16 +424,16 @@ void input_sequence_test::test()
{
std::vector<double> const v{3};
InputSequence const seq(v);
- BOOST_TEST(v == seq.seriatim_numbers());
- BOOST_TEST_EQUAL("3", canonicalized_input_sequence(v));
+ LMI_TEST(v == seq.seriatim_numbers());
+ LMI_TEST_EQUAL("3", canonicalized_input_sequence(v));
}
// Test construction from empty vector.
{
std::vector<double> const v;
InputSequence const seq(v);
- BOOST_TEST(v == seq.seriatim_numbers());
- BOOST_TEST_EQUAL("0", canonicalized_input_sequence(v));
+ LMI_TEST(v == seq.seriatim_numbers());
+ LMI_TEST_EQUAL("0", canonicalized_input_sequence(v));
}
// Test (enumerative) allowed keywords, and keywords-only switch
@@ -486,7 +486,7 @@ void input_sequence_test::test()
strvec const k{"p", "q", "z"};
std::string w("z");
check(__FILE__, __LINE__, n, d, e, g, m, k, c, false, w);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(std::string(m)
,abridge_diagnostics(m)
);
@@ -510,7 +510,7 @@ void input_sequence_test::test()
bool const o = true;
std::string w("z");
check(__FILE__, __LINE__, n, d, e, g, m, k, c, o, w);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Expected keyword chosen from { p q z }."
,abridge_diagnostics(m)
);
@@ -552,7 +552,7 @@ void input_sequence_test::test()
bool const o = true;
std::string w("u");
check(__FILE__, __LINE__, n, d, e, g, m, k, c, o, w);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(std::string(m)
,abridge_diagnostics(m)
);
@@ -599,10 +599,10 @@ void input_sequence_test::test()
check(__FILE__, __LINE__, n, d, e, g);
InputSequence const seq(e, 10, 90, 95, 0, 2002);
std::vector<ValueInterval> const& i(seq.intervals());
- BOOST_TEST_EQUAL(e_inception , i[0].begin_mode);
- BOOST_TEST_EQUAL(e_retirement, i[0].end_mode );
- BOOST_TEST_EQUAL(e_retirement, i[1].begin_mode);
- BOOST_TEST_EQUAL(e_maturity , i[1].end_mode );
+ LMI_TEST_EQUAL(e_inception , i[0].begin_mode);
+ LMI_TEST_EQUAL(e_retirement, i[0].end_mode );
+ LMI_TEST_EQUAL(e_retirement, i[1].begin_mode);
+ LMI_TEST_EQUAL(e_maturity , i[1].end_mode );
}
// Duration keywords, with a one-time-only event at retirement.
@@ -615,12 +615,12 @@ void input_sequence_test::test()
check(__FILE__, __LINE__, n, d, e, g);
InputSequence const seq(e, 10, 90, 95, 0, 2002);
std::vector<ValueInterval> const& i(seq.intervals());
- BOOST_TEST_EQUAL(e_inception , i[0].begin_mode);
- BOOST_TEST_EQUAL(e_retirement, i[0].end_mode );
- BOOST_TEST_EQUAL(e_retirement, i[1].begin_mode);
- BOOST_TEST_EQUAL(e_duration , i[1].end_mode );
- BOOST_TEST_EQUAL(e_retirement, i[2].begin_mode);
- BOOST_TEST_EQUAL(e_maturity , i[2].end_mode );
+ LMI_TEST_EQUAL(e_inception , i[0].begin_mode);
+ LMI_TEST_EQUAL(e_retirement, i[0].end_mode );
+ LMI_TEST_EQUAL(e_retirement, i[1].begin_mode);
+ LMI_TEST_EQUAL(e_duration , i[1].end_mode );
+ LMI_TEST_EQUAL(e_retirement, i[2].begin_mode);
+ LMI_TEST_EQUAL(e_maturity , i[2].end_mode );
}
// Duration keywords, with a one-year-long event at retirement.
@@ -643,12 +643,12 @@ void input_sequence_test::test()
check(__FILE__, __LINE__, n, d, e, g);
InputSequence const seq(e, 10, 90, 95, 0, 2002);
std::vector<ValueInterval> const& i(seq.intervals());
- BOOST_TEST_EQUAL(e_inception , i[0].begin_mode);
- BOOST_TEST_EQUAL(e_retirement , i[0].end_mode );
- BOOST_TEST_EQUAL(e_retirement , i[1].begin_mode);
- BOOST_TEST_EQUAL(e_number_of_years, i[1].end_mode );
- BOOST_TEST_EQUAL(e_number_of_years, i[2].begin_mode);
- BOOST_TEST_EQUAL(e_maturity , i[2].end_mode );
+ LMI_TEST_EQUAL(e_inception , i[0].begin_mode);
+ LMI_TEST_EQUAL(e_retirement , i[0].end_mode );
+ LMI_TEST_EQUAL(e_retirement , i[1].begin_mode);
+ LMI_TEST_EQUAL(e_number_of_years, i[1].end_mode );
+ LMI_TEST_EQUAL(e_number_of_years, i[2].begin_mode);
+ LMI_TEST_EQUAL(e_maturity , i[2].end_mode );
}
// Test a simple parser error.
@@ -663,7 +663,7 @@ void input_sequence_test::test()
" Current token '[' at position 1.\n"
;
check(__FILE__, __LINE__, n, d, e, g, m);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Expected number or keyword."
,abridge_diagnostics(m)
);
diff --git a/input_test.cpp b/input_test.cpp
index 3487192..1a65ec4 100644
--- a/input_test.cpp
+++ b/input_test.cpp
@@ -122,7 +122,7 @@ void input_test::test_product_database()
db.query_into(DB_StatVxQ, v);
w.assign(stat, stat + 10);
w.insert(w.end(), db.length() - w.size(), w.back());
- BOOST_TEST(v == w);
+ LMI_TEST(v == w);
// This vector must be truncated.
int dims_tax[e_number_of_axes] = {1, 1, 1, 1, 1, 1, 100};
@@ -146,10 +146,10 @@ void input_test::test_product_database()
);
db.query_into(DB_TaxVxQ, v);
w.assign(tax, tax + db.length());
- BOOST_TEST(v == w);
+ LMI_TEST(v == w);
// Scalar access is forbidden when entity varies by duration.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(db.query<double>(DB_StatVxQ)
,std::runtime_error
,"Assertion '1 == v.extent()' failed."
@@ -161,9 +161,9 @@ void input_test::test_product_database()
// This value corresponds to no enumerator, but C++ allows that.
db.query_into(DB_ChildRiderMinAmt, a);
- BOOST_TEST_EQUAL(25000, a);
+ LMI_TEST_EQUAL(25000, a);
auto const b {db.query<oenum_alb_or_anb>(DB_ChildRiderMinAmt)};
- BOOST_TEST_EQUAL(25000, b);
+ LMI_TEST_EQUAL(25000, b);
// Redundant template argument is okay.
db.query_into<oenum_alb_or_anb>(DB_ChildRiderMinAmt, a);
@@ -172,7 +172,7 @@ void input_test::test_product_database()
// db.query_into<bool >(DB_ChildRiderMinAmt, a);
// This value is not integral, so bourn_cast rejects it.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(db.query_into(DB_NaarDiscount, a)
,std::runtime_error
,"Cast would not preserve value."
@@ -187,7 +187,7 @@ void input_test::test_product_database()
,dims_stat
,stat
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(db.query<int>(DB_MaturityAge)
,std::runtime_error
,"Assertion '1 == v.extent()' failed."
@@ -204,30 +204,30 @@ void input_test::test_product_database()
,tax
);
db.query_into(DB_SnflQ, v);
- BOOST_TEST_EQUAL(55, db.length());
- BOOST_TEST_EQUAL(55, v.size());
+ LMI_TEST_EQUAL(55, db.length());
+ LMI_TEST_EQUAL(55, v.size());
database_index index = db.index().issue_age(29);
db.query_into(DB_SnflQ, v, index);
- BOOST_TEST_EQUAL(55, db.length());
- BOOST_TEST_EQUAL(71, v.size());
+ LMI_TEST_EQUAL(55, db.length());
+ LMI_TEST_EQUAL(71, v.size());
// Test presumptive issue-age bounds in class database_index.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
((database_index {mce_male, mce_rated, mce_smoker, 100, mce_medical,
mce_s_XX})
,std::runtime_error
,"Assertion '0 <= issue_age() && issue_age() < e_max_dim_issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
((database_index {mce_male, mce_rated, mce_smoker, -1, mce_medical,
mce_s_XX})
,std::runtime_error
,"Assertion '0 <= issue_age() && issue_age() < e_max_dim_issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(index.issue_age(100)
,std::runtime_error
,"Assertion '0 <= issue_age() && issue_age() < e_max_dim_issue_age'
failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(index.issue_age(-1)
,std::runtime_error
,"Assertion '0 <= issue_age() && issue_age() < e_max_dim_issue_age'
failed."
@@ -235,13 +235,13 @@ void input_test::test_product_database()
database_index idx99 = index.issue_age(99);
db.query_into(DB_SnflQ, v, idx99);
- BOOST_TEST_EQUAL( 1, v.size());
+ LMI_TEST_EQUAL( 1, v.size());
// Force the product to mature at 98.
db.maturity_age_ = 98;
database_index idx98 = index.issue_age(98);
db.query(DB_MaturityAge, idx98); // Accepted because maturity age is
scalar.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(db.query_into(DB_SnflQ, v, idx98)
,std::runtime_error
,"Assertion '0 < local_length && local_length <= methuselah' failed."
@@ -249,11 +249,11 @@ void input_test::test_product_database()
index.issue_age(97);
db.query_into(DB_SnflQ, v, index.issue_age(97));
- BOOST_TEST_EQUAL( 1, v.size());
+ LMI_TEST_EQUAL( 1, v.size());
index.issue_age(0);
db.query_into(DB_SnflQ, v, index.issue_age(0));
- BOOST_TEST_EQUAL(98, v.size());
+ LMI_TEST_EQUAL(98, v.size());
auto f0 = [&db] {db.initialize("sample");};
auto f1 = [&db, &v] {db.query_into(DB_MaturityAge, v);};
@@ -280,7 +280,7 @@ void input_test::test_input_class()
Input replica;
std::ofstream os0("eraseme0.xml", ios_out_trunc_binary());
- BOOST_TEST(os0.good());
+ LMI_TEST(os0.good());
original.AgentName = "Herbert Cassidy";
original.AgentPhone = "123-4567";
@@ -317,7 +317,7 @@ void input_test::test_input_class()
xml_node >> replica;
std::ofstream os1("eraseme1.xml", ios_out_trunc_binary());
- BOOST_TEST(os1.good());
+ LMI_TEST(os1.good());
xml_lmi::xml_document xml_document1("root");
xml::element& xml_root1 = xml_document1.root_node();
@@ -325,25 +325,25 @@ void input_test::test_input_class()
os1 << xml_document1;
os1.close();
- BOOST_TEST(original == replica);
+ LMI_TEST(original == replica);
bool okay = files_are_identical("eraseme0.xml", "eraseme1.xml");
- BOOST_TEST(okay);
+ LMI_TEST(okay);
// Leave the files for analysis if they didn't match.
if(okay)
{
- BOOST_TEST(0 == std::remove("eraseme0.xml"));
- BOOST_TEST(0 == std::remove("eraseme1.xml"));
+ LMI_TEST(0 == std::remove("eraseme0.xml"));
+ LMI_TEST(0 == std::remove("eraseme1.xml"));
}
- BOOST_TEST(0.03125 == original.SeparateAccountRateRealized_[0]);
- BOOST_TEST(replica.SeparateAccountRateRealized_.empty());
+ LMI_TEST(0.03125 == original.SeparateAccountRateRealized_[0]);
+ LMI_TEST(replica.SeparateAccountRateRealized_.empty());
replica.RealizeAllSequenceInput();
- BOOST_TEST(!replica.SeparateAccountRateRealized_.empty());
- BOOST_TEST(0.03125 == replica.SeparateAccountRateRealized_[0]);
+ LMI_TEST(!replica.SeparateAccountRateRealized_.empty());
+ LMI_TEST(0.03125 == replica.SeparateAccountRateRealized_[0]);
/* TODO ?? The code this tests is defective--fix it someday.
- BOOST_TEST(0.4 == original.FundAllocs[0]);
- BOOST_TEST(0.4 == replica.FundAllocs[0]);
+ LMI_TEST(0.4 == original.FundAllocs[0]);
+ LMI_TEST(0.4 == replica.FundAllocs[0]);
std::cout << "original.FundAllocs[0] is " << original.FundAllocs[0] << '\n';
std::cout << "replica.FundAllocs[0] is " << replica.FundAllocs[0] << '\n';
@@ -351,31 +351,31 @@ std::cout << "original.FundAllocs.size() is " <<
original.FundAllocs.size() << '
std::cout << "replica.FundAllocs.size() is " << replica.FundAllocs.size() <<
'\n';
*/
- BOOST_TEST(0 == original.InforceYear);
+ LMI_TEST(0 == original.InforceYear);
original["InforceYear"] = std::string("3");
- BOOST_TEST(3 == original.InforceYear);
+ LMI_TEST(3 == original.InforceYear);
// Fails--need to change initialization.
- BOOST_TEST(45 == original.IssueAge);
+ LMI_TEST(45 == original.IssueAge);
original["IssueAge"] = std::string("57");
- BOOST_TEST(57 == original.IssueAge);
+ LMI_TEST(57 == original.IssueAge);
// Test copy constructor.
Input copy0(original);
- BOOST_TEST(original == copy0);
+ LMI_TEST(original == copy0);
copy0["InsuredName"] = "Claude Proulx";
- BOOST_TEST(!(original == copy0));
- BOOST_TEST(std::string("Claude Proulx") == copy0 .InsuredName.value());
- BOOST_TEST(std::string("Full Name") == original.InsuredName.value());
+ LMI_TEST(!(original == copy0));
+ LMI_TEST(std::string("Claude Proulx") == copy0 .InsuredName.value());
+ LMI_TEST(std::string("Full Name") == original.InsuredName.value());
// Test assignment operator.
Input copy1;
copy1 = original;
- BOOST_TEST(original == copy1);
+ LMI_TEST(original == copy1);
copy1["InsuredName"] = "Angela";
- BOOST_TEST(!(original == copy1));
- BOOST_TEST(std::string("Angela") == copy1 .InsuredName.value());
- BOOST_TEST(std::string("Full Name") == original.InsuredName.value());
+ LMI_TEST(!(original == copy1));
+ LMI_TEST(std::string("Angela") == copy1 .InsuredName.value());
+ LMI_TEST(std::string("Full Name") == original.InsuredName.value());
// For now at least, just test that this compiles and runs.
yare_input y(original);
@@ -395,46 +395,46 @@ void input_test::test_obsolete_history()
z.InforceYear = 0;
z.InforceMonth = 0;
// For new business, history is irrelevant.
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("0"
, "1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("0" ,
"1" , true));
// Year 0, month 1: one year of history.
z.InforceYear = 0;
z.InforceMonth = 1;
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0"
, "1" , true));
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1"
, "1" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0" ,
"1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1" ,
"1" , true));
// Year 1, month 0: one year of history.
z.InforceYear = 1;
z.InforceMonth = 0;
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0"
, "1" , true));
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1"
, "1" , true));
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1"
, "1;2" , true));
- BOOST_TEST_EQUAL(1, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "2" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0" ,
"1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1" ,
"1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1" ,
"1;2" , true));
+ LMI_TEST_EQUAL(1, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"2" , true));
// "History" after first year doesn't matter.
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"1" , true));
// Year 1, month 1: two years of history.
z.InforceYear = 1;
z.InforceMonth = 1;
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1"
, "1" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1" ,
"1" , true));
// No conflict: history is a "subset" of specamt.
- BOOST_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "1;2;3" , true));
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "1" , true));
- BOOST_TEST_EQUAL(1, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "2" , true));
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1"
, "1;2" , true));
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "2;3" , true));
- BOOST_TEST_EQUAL(0,
z.must_overwrite_specamt_with_obsolete_history("1;2;3", "1;2;3" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"1;2;3" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"1" , true));
+ LMI_TEST_EQUAL(1, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"2" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1" ,
"1;2" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"2;3" , true));
+ LMI_TEST_EQUAL(0, z.must_overwrite_specamt_with_obsolete_history("1;2;3",
"1;2;3" , true));
// Warn if a keyword is used--this one's meaning depends on context.
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "1;corridor" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"1;corridor" , true));
// Keyword may engender "obvious" false positives.
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2"
, "1;2;corridor", true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1;2" ,
"1;2;corridor", true));
// This would have been forbidden: history was numeric only.
-// BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("X"
, "1" , true));
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1"
, "X" , true));
+// LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("X" ,
"1" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("1" ,
"X" , true));
// This case differs little from the preceding one, but formerly it
// had a different outcome. Reason: non-numeric substrings were
// interepreted as zero, simply because realize_vector() exited
// early if the input-sequence parser emitted any diagnostics. Now,
// however, any parser diagnostic raises an exception, which causes
// must_overwrite_specamt_with_obsolete_history() to return 2.
- BOOST_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0"
, "X" , true));
+ LMI_TEST_EQUAL(2, z.must_overwrite_specamt_with_obsolete_history("0" ,
"X" , true));
}
void input_test::assay_speed()
@@ -483,11 +483,11 @@ void input_test::test_document_io
ofs.close();
bool okay = files_are_identical(original_filename, replica_filename);
- INVOKE_BOOST_TEST(okay, file, line);
+ INVOKE_LMI_TEST(okay, file, line);
// Leave the file for analysis if it didn't match.
if(okay)
{
- INVOKE_BOOST_TEST
+ INVOKE_LMI_TEST
(0 == std::remove(replica_filename.c_str())
,file
,line
diff --git a/interpolate_string_test.cpp b/interpolate_string_test.cpp
index 249f95b..cbe6fd4 100644
--- a/interpolate_string_test.cpp
+++ b/interpolate_string_test.cpp
@@ -38,18 +38,18 @@ int test_main(int, char*[])
};
// Check that basic interpolation works.
- BOOST_TEST_EQUAL( test_interpolate(""), "" );
- BOOST_TEST_EQUAL( test_interpolate("literal"), "literal" );
- BOOST_TEST_EQUAL( test_interpolate("{{foo}}"), "foo" );
- BOOST_TEST_EQUAL( test_interpolate("{{foo}}bar"), "foobar" );
- BOOST_TEST_EQUAL( test_interpolate("foo{{}}bar"), "foobar" );
- BOOST_TEST_EQUAL( test_interpolate("foo{{bar}}"), "foobar" );
- BOOST_TEST_EQUAL( test_interpolate("{{foo}}{{bar}}"), "foobar" );
+ LMI_TEST_EQUAL( test_interpolate(""), "" );
+ LMI_TEST_EQUAL( test_interpolate("literal"), "literal" );
+ LMI_TEST_EQUAL( test_interpolate("{{foo}}"), "foo" );
+ LMI_TEST_EQUAL( test_interpolate("{{foo}}bar"), "foobar" );
+ LMI_TEST_EQUAL( test_interpolate("foo{{}}bar"), "foobar" );
+ LMI_TEST_EQUAL( test_interpolate("foo{{bar}}"), "foobar" );
+ LMI_TEST_EQUAL( test_interpolate("{{foo}}{{bar}}"), "foobar" );
// Comments should be just ignored.
- BOOST_TEST_EQUAL( test_interpolate("{{! ignore me}}"), "" );
- BOOST_TEST_EQUAL( test_interpolate("{{! too}}{{x}}"), "x" );
- BOOST_TEST_EQUAL( test_interpolate("{{x}}{{!also}}"), "x" );
+ LMI_TEST_EQUAL( test_interpolate("{{! ignore me}}"), "" );
+ LMI_TEST_EQUAL( test_interpolate("{{! too}}{{x}}"), "x" );
+ LMI_TEST_EQUAL( test_interpolate("{{x}}{{!also}}"), "x" );
// Recursive interpolation should work too.
auto const test_recursive = [](char const* s)
@@ -70,17 +70,17 @@ int test_main(int, char*[])
);
};
- BOOST_TEST_EQUAL( test_recursive("{{rec3}}"), "3" );
- BOOST_TEST_EQUAL( test_recursive("{{rec2}}"), "2 3" );
- BOOST_TEST_EQUAL( test_recursive("{{rec1}}"), "1 2 3" );
+ LMI_TEST_EQUAL( test_recursive("{{rec3}}"), "3" );
+ LMI_TEST_EQUAL( test_recursive("{{rec2}}"), "2 3" );
+ LMI_TEST_EQUAL( test_recursive("{{rec1}}"), "1 2 3" );
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(test_recursive("error due to infinite recursion in {{inf}}")
,std::runtime_error
,lmi_test::what_regex("Nesting level too deep")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(test_recursive("infinite co-recursion in {{infA}} is detected too")
,std::runtime_error
,lmi_test::what_regex("Nesting level too deep")
@@ -102,24 +102,24 @@ int test_main(int, char*[])
);
};
- BOOST_TEST_EQUAL( section_test("x{{#var1}}y{{/var1}}z"), "xyz" );
- BOOST_TEST_EQUAL( section_test("x{{#var0}}y{{/var0}}z"), "xz" );
- BOOST_TEST_EQUAL( section_test("x{{^var0}}y{{/var0}}z"), "xyz" );
- BOOST_TEST_EQUAL( section_test("x{{^var1}}y{{/var1}}z"), "xz" );
+ LMI_TEST_EQUAL( section_test("x{{#var1}}y{{/var1}}z"), "xyz" );
+ LMI_TEST_EQUAL( section_test("x{{#var0}}y{{/var0}}z"), "xz" );
+ LMI_TEST_EQUAL( section_test("x{{^var0}}y{{/var0}}z"), "xyz" );
+ LMI_TEST_EQUAL( section_test("x{{^var1}}y{{/var1}}z"), "xz" );
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(section_test("a{{#var1}}b{{#var1}}c{{/var1}}d{{/var1}}e")
,"abcde"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(section_test("a{{#var1}}b{{#var0}}c{{/var0}}d{{/var1}}e")
,"abde"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(section_test("a{{^var1}}b{{#var0}}c{{/var0}}d{{/var1}}e")
,"ae"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(section_test("a{{^var1}}b{{^var0}}c{{/var0}}d{{/var1}}e")
,"ae"
);
@@ -143,44 +143,44 @@ int test_main(int, char*[])
);
};
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("{{>header}}")
,"[header with variable]"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("{{>header}}{{var}} in body{{>footer}}")
,"[header with variable]variable in body[footer with variable]"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("{{#sec}}{{>header}}{{/sec}}")
,"[header with variable]"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("only{{^sec}}{{>header}}{{/sec}}{{>footer}}")
,"only[footer with variable]"
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("{{>nested}}")
,"[header with [footer with variable]]"
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(partial_test("{{>recursive}}")
,std::runtime_error
,lmi_test::what_regex("Nesting level too deep")
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(partial_test("no {{^sec}}{{>recursive}}{{/sec}} problem")
,"no problem"
);
// Check that the kind of variable being expanded is correct.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(interpolate_string
("{{>test}}"
"{{#section1}}{{^section0}}{{variable}}{{/section0}}{{/section1}}"
@@ -206,39 +206,39 @@ int test_main(int, char*[])
);
// Should throw if the input syntax is invalid.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(test_interpolate("{{x")
,std::runtime_error
,lmi_test::what_regex("Unmatched opening brace")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(test_interpolate("{{x{{y}}}}")
,std::runtime_error
,lmi_test::what_regex("Unexpected nested interpolation")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(section_test("{{#var1}}")
,std::runtime_error
,lmi_test::what_regex("Unclosed section 'var1'")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(section_test("{{^var0}}")
,std::runtime_error
,lmi_test::what_regex("Unclosed section 'var0'")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(section_test("{{/var1}}")
,std::runtime_error
,lmi_test::what_regex("Unexpected end of section")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(section_test("{{#var1}}{{/var0}}")
,std::runtime_error
,lmi_test::what_regex("Unexpected end of section")
);
// Or because the lookup function throws.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(interpolate_string
("{{x}}"
,[](std::string const& s, interpolate_lookup_kind) -> std::string
diff --git a/irc7702_tables_test.cpp b/irc7702_tables_test.cpp
index 3b4f6ec..25ecd2d 100644
--- a/irc7702_tables_test.cpp
+++ b/irc7702_tables_test.cpp
@@ -477,27 +477,27 @@ void Test_Corridor_and_7PP()
// NSP[omega-1] = vq * (i/delta) + vp
// = (0.30285 / (1.0 + iglp)) * (iglp / ln((1.0 + iglp)))
// + (1 - 0.30285) / (1.0 + iglp)
- BOOST_TEST(materially_equal(0.30285, z.q_[99], 0.0));
+ LMI_TEST(materially_equal(0.30285, z.q_[99], 0.0));
double ol_nsp99 =
( z.q_[99] / (1.0 + iglp)) * (iglp / std::log((1.0 + iglp)))
+ (1.0 - z.q_[99]) / (1.0 + iglp)
;
- BOOST_TEST(materially_equal(ol_corr[99], 1.0 / ol_nsp99, DBL_EPSILON));
+ LMI_TEST(materially_equal(ol_corr[99], 1.0 / ol_nsp99, DBL_EPSILON));
for(int j = 0; j < lmi::ssize(ol_corr); ++j)
{
// Values calculated here must match spreadsheet values to
// within a minuscule tolerance.
- BOOST_TEST(materially_equal(ss_ul_corr[j], ul_corr[j]));
- BOOST_TEST(materially_equal(ss_ul_7pp [j], ul_7pp [j]));
- BOOST_TEST(materially_equal(ss_ol_corr[j], ol_corr[j]));
- BOOST_TEST(materially_equal(ss_ol_7pp [j], ol_7pp [j]));
+ LMI_TEST(materially_equal(ss_ul_corr[j], ul_corr[j]));
+ LMI_TEST(materially_equal(ss_ul_7pp [j], ul_7pp [j]));
+ LMI_TEST(materially_equal(ss_ol_corr[j], ol_corr[j]));
+ LMI_TEST(materially_equal(ss_ol_7pp [j], ol_7pp [j]));
// The 0.0015 tolerance was found experimentally, not by any
// sort of mathematical law. It represents the inherent
// discrepancy between the UL method on the one hand, and the
// OL method (with the i/delta approximation) on the other.
- BOOST_TEST(materially_equal( ol_corr[j], ul_corr[j], 0.0015));
- BOOST_TEST(materially_equal( ol_7pp [j], ul_7pp [j], 0.0015));
+ LMI_TEST(materially_equal( ol_corr[j], ul_corr[j], 0.0015));
+ LMI_TEST(materially_equal( ol_7pp [j], ul_7pp [j], 0.0015));
}
// At least for now, display plenty of detail.
diff --git a/irc7702a_test.cpp b/irc7702a_test.cpp
index 9ba6249..8856d3f 100644
--- a/irc7702a_test.cpp
+++ b/irc7702a_test.cpp
@@ -49,7 +49,7 @@ void test00(Irc7702A z)
,bft_history // a_Bfts
);
z.UpdateEOM7702A();
- BOOST_TEST(z.IsMecAlready());
+ LMI_TEST(z.IsMecAlready());
}
void test01(Irc7702A z)
@@ -97,7 +97,7 @@ void test01(Irc7702A z)
// TODO ?? Is the second arg to UpdateBft7702A() really needed?
// TODO ?? If it is, can we assert that it has the expected value?
z.UpdateEOM7702A();
- BOOST_TEST(!z.IsMecAlready());
+ LMI_TEST(!z.IsMecAlready());
z.UpdateBft7702A
(0.0
,0.0 // a_NewDB
@@ -109,7 +109,7 @@ void test01(Irc7702A z)
);
z.UpdateEOM7702A();
- BOOST_TEST(z.IsMecAlready());
+ LMI_TEST(z.IsMecAlready());
}
// Pay premium almost equal to specamt: expect MEC.
@@ -135,7 +135,7 @@ void test02(Irc7702A z)
,100000.0 // a_OldSA
,0.0 // a_CashValue
);
- BOOST_TEST(!z.IsMecAlready());
+ LMI_TEST(!z.IsMecAlready());
z.UpdateEOM7702A();
// Second month.
@@ -151,7 +151,7 @@ void test02(Irc7702A z)
,0.0 // a_CashValue
);
z.UpdateEOM7702A();
- BOOST_TEST(z.IsMecAlready());
+ LMI_TEST(z.IsMecAlready());
}
// Decrease Bfts then increase Bfts.
@@ -178,7 +178,7 @@ void test03(Irc7702A z)
,0.0 // a_CashValue
);
z.UpdateEOM7702A();
- BOOST_TEST(!z.IsMecAlready()); // TODO ?? Fails?
+ LMI_TEST(!z.IsMecAlready()); // TODO ?? Fails?
// Second year, second month.
z.UpdateBOY7702A(1);
@@ -202,7 +202,7 @@ void test03(Irc7702A z)
,0.0 // a_CashValue
);
z.UpdateEOM7702A();
- BOOST_TEST(!z.IsMecAlready()); // TODO ?? Fails?
+ LMI_TEST(!z.IsMecAlready()); // TODO ?? Fails?
}
int test_main(int, char*[])
diff --git a/istream_to_string_test.cpp b/istream_to_string_test.cpp
index c49b2a1..ac52467 100644
--- a/istream_to_string_test.cpp
+++ b/istream_to_string_test.cpp
@@ -132,10 +132,10 @@ void test_empty_file()
std::ofstream ofs(empty_file, ios_out_trunc_binary());
ofs.close();
- BOOST_TEST(mete_0<empty_file>().empty());
- BOOST_TEST(mete_1<empty_file>().empty());
- BOOST_TEST(mete_2<empty_file>().empty());
- BOOST_TEST(mete_3<empty_file>().empty());
+ LMI_TEST(mete_0<empty_file>().empty());
+ LMI_TEST(mete_1<empty_file>().empty());
+ LMI_TEST(mete_2<empty_file>().empty());
+ LMI_TEST(mete_3<empty_file>().empty());
std::remove(empty_file);
}
@@ -146,10 +146,10 @@ void test_nonempty_file()
ofs << alphabet;
ofs.close();
- BOOST_TEST_EQUAL(alphabet, mete_0<nonempty_file>());
- BOOST_TEST_EQUAL(alphabet, mete_1<nonempty_file>());
- BOOST_TEST_EQUAL(alphabet, mete_2<nonempty_file>());
- BOOST_TEST_EQUAL(alphabet, mete_3<nonempty_file>());
+ LMI_TEST_EQUAL(alphabet, mete_0<nonempty_file>());
+ LMI_TEST_EQUAL(alphabet, mete_1<nonempty_file>());
+ LMI_TEST_EQUAL(alphabet, mete_2<nonempty_file>());
+ LMI_TEST_EQUAL(alphabet, mete_3<nonempty_file>());
std::remove(nonempty_file);
}
diff --git a/ledger_test.cpp b/ledger_test.cpp
index 8545d1d..d978ccb 100644
--- a/ledger_test.cpp
+++ b/ledger_test.cpp
@@ -54,17 +54,17 @@ void ledger_test::test_default_initialization()
{
Ledger ledger(100, mce_finra, false, false, false);
- BOOST_TEST_EQUAL(mce_finra, ledger.ledger_type());
- BOOST_TEST_EQUAL(false , ledger.nonillustrated());
- BOOST_TEST_EQUAL(false , ledger.no_can_issue());
- BOOST_TEST_EQUAL(false , ledger.is_composite());
- BOOST_TEST_EQUAL(100 , ledger.greatest_lapse_dur());
+ LMI_TEST_EQUAL(mce_finra, ledger.ledger_type());
+ LMI_TEST_EQUAL(false , ledger.nonillustrated());
+ LMI_TEST_EQUAL(false , ledger.no_can_issue());
+ LMI_TEST_EQUAL(false , ledger.is_composite());
+ LMI_TEST_EQUAL(100 , ledger.greatest_lapse_dur());
LedgerInvariant const& invar = ledger.GetLedgerInvariant();
- BOOST_TEST_EQUAL(100 , invar.GetLength());
- BOOST_TEST_EQUAL(0 , invar.Age);
- BOOST_TEST_EQUAL(100 , invar.EndtAge);
+ LMI_TEST_EQUAL(100 , invar.GetLength());
+ LMI_TEST_EQUAL(0 , invar.Age);
+ LMI_TEST_EQUAL(100 , invar.EndtAge);
}
void ledger_test::test_evaluator()
@@ -73,7 +73,7 @@ void ledger_test::test_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"));
+ LMI_TEST(0 == std::remove("tsv_eraseme.values.tsv"));
}
void ledger_test::test_speed()
@@ -92,7 +92,7 @@ void ledger_test::test_speed()
<< "\n write_tsv() : " << TimeAnAliquot(f2)
<< std::endl
;
- BOOST_TEST(0 == std::remove("tsv_eraseme.values.tsv"));
+ LMI_TEST(0 == std::remove("tsv_eraseme.values.tsv"));
}
int test_main(int, char*[])
diff --git a/loads_test.cpp b/loads_test.cpp
index 2e6c2aa..460fd72 100644
--- a/loads_test.cpp
+++ b/loads_test.cpp
@@ -110,89 +110,89 @@ void LoadsTest::TestVectorLengths(char const* file, int
line)
{
int const z = details_.length_;
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.refundable_sales_load_proportion ()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.premium_tax_load
()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.amortized_premium_tax_load
()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.dac_tax_load
()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_excluding_premium_tax()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_excluding_premium_tax()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_maximum_premium_tax ()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_maximum_premium_tax ()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_minimum_premium_tax ()), file, line);
- INVOKE_BOOST_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_minimum_premium_tax ()), file, line);
-
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_curr)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_curr)), file, line);
-
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_guar)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_guar)), file, line);
-
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_mdpt)), file, line);
- INVOKE_BOOST_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.refundable_sales_load_proportion ()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.premium_tax_load
()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.amortized_premium_tax_load
()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.dac_tax_load
()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_excluding_premium_tax()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_excluding_premium_tax()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_maximum_premium_tax ()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_maximum_premium_tax ()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.target_premium_load_minimum_premium_tax ()), file, line);
+ INVOKE_LMI_TEST_EQUAL(z,
lmi::ssize(loads_.excess_premium_load_minimum_premium_tax ()), file, line);
+
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_curr)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_curr)), file, line);
+
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_guar)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_guar)), file, line);
+
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.monthly_policy_fee
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.annual_policy_fee
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.specified_amount_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.separate_account_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_premium_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_premium_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_sales_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_sales_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.target_total_load
(mce_gen_mdpt)), file, line);
+ INVOKE_LMI_TEST_EQUAL(z, lmi::ssize(loads_.excess_total_load
(mce_gen_mdpt)), file, line);
}
void LoadsTest::TestCalculations(char const* file, int line)
{
- INVOKE_BOOST_TEST(materially_equal(0.500000,
loads_.refundable_sales_load_proportion()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.500000,
loads_.refundable_sales_load_proportion()[0]), file, line);
// (8.00 + 5.25 + 0.50) / 2 = 13.75 / 2 = 6.875, rounded to cents
# if defined CURRENCY_UNIT_IS_CENTS
- INVOKE_BOOST_TEST(from_cents(688) == loads_.monthly_policy_fee
(mce_gen_mdpt)[0] , file, line);
+ INVOKE_LMI_TEST(from_cents(688) == loads_.monthly_policy_fee
(mce_gen_mdpt)[0] , file, line);
# else // !defined CURRENCY_UNIT_IS_CENTS
- INVOKE_BOOST_TEST(materially_equal(6.88, dblize(loads_.monthly_policy_fee
(mce_gen_mdpt)[0])), file, line);
+ INVOKE_LMI_TEST(materially_equal(6.88, dblize(loads_.monthly_policy_fee
(mce_gen_mdpt)[0])), file, line);
# endif // !defined CURRENCY_UNIT_IS_CENTS
- INVOKE_BOOST_TEST(from_cents(150) == loads_.annual_policy_fee
(mce_gen_mdpt)[0] , file, line);
- INVOKE_BOOST_TEST(materially_equal(0.000625, loads_.specified_amount_load
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(from_cents(150) == loads_.annual_policy_fee
(mce_gen_mdpt)[0] , file, line);
+ INVOKE_LMI_TEST(materially_equal(0.000625, loads_.specified_amount_load
(mce_gen_mdpt)[0]), file, line);
// 12 bp and 19 bp, both converted to monthly, then added together.
- INVOKE_BOOST_TEST(materially_equal(0.0002581402795930,
loads_.separate_account_load (mce_gen_mdpt)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.030000, loads_.target_premium_load
(mce_gen_mdpt)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.020000, loads_.excess_premium_load
(mce_gen_mdpt)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.217000, loads_.target_sales_load
(mce_gen_mdpt)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.117000, loads_.excess_sales_load
(mce_gen_mdpt)[0]), file, line);
-
- INVOKE_BOOST_TEST(materially_equal(0.383000, loads_.target_total_load
(mce_gen_guar)[0]), file, line); // 0.30 + 0.04 + 0.021 + 0.005 + 0.017
- INVOKE_BOOST_TEST(materially_equal(0.223000, loads_.excess_total_load
(mce_gen_guar)[0]), file, line); // 0.15 + 0.03 + 0.021 + 0.005 + 0.017
- INVOKE_BOOST_TEST(materially_equal(0.163000, loads_.target_total_load
(mce_gen_curr)[0]), file, line); // 0.10 + 0.02 + 0.021 + 0.005 + 0.017
- INVOKE_BOOST_TEST(materially_equal(0.103000, loads_.excess_total_load
(mce_gen_curr)[0]), file, line); // 0.05 + 0.01 + 0.021 + 0.005 + 0.017
- INVOKE_BOOST_TEST(materially_equal(0.273000, loads_.target_total_load
(mce_gen_mdpt)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.163000, loads_.excess_total_load
(mce_gen_mdpt)[0]), file, line);
-
- INVOKE_BOOST_TEST(materially_equal(0.021000, loads_.premium_tax_load
()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.000000,
loads_.amortized_premium_tax_load ()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.005000, loads_.dac_tax_load
()[0]), file, line);
-
- INVOKE_BOOST_TEST(materially_equal(0.163000, loads_.target_total_load
(mce_gen_curr)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.103000, loads_.excess_total_load
(mce_gen_curr)[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.142000,
loads_.target_premium_load_excluding_premium_tax()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.082000,
loads_.excess_premium_load_excluding_premium_tax()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.164000,
loads_.target_premium_load_maximum_premium_tax ()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.104000,
loads_.excess_premium_load_maximum_premium_tax ()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.162000,
loads_.target_premium_load_minimum_premium_tax ()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(0.102000,
loads_.excess_premium_load_minimum_premium_tax ()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.0002581402795930,
loads_.separate_account_load (mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.030000, loads_.target_premium_load
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.020000, loads_.excess_premium_load
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.217000, loads_.target_sales_load
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.117000, loads_.excess_sales_load
(mce_gen_mdpt)[0]), file, line);
+
+ INVOKE_LMI_TEST(materially_equal(0.383000, loads_.target_total_load
(mce_gen_guar)[0]), file, line); // 0.30 + 0.04 + 0.021 + 0.005 + 0.017
+ INVOKE_LMI_TEST(materially_equal(0.223000, loads_.excess_total_load
(mce_gen_guar)[0]), file, line); // 0.15 + 0.03 + 0.021 + 0.005 + 0.017
+ INVOKE_LMI_TEST(materially_equal(0.163000, loads_.target_total_load
(mce_gen_curr)[0]), file, line); // 0.10 + 0.02 + 0.021 + 0.005 + 0.017
+ INVOKE_LMI_TEST(materially_equal(0.103000, loads_.excess_total_load
(mce_gen_curr)[0]), file, line); // 0.05 + 0.01 + 0.021 + 0.005 + 0.017
+ INVOKE_LMI_TEST(materially_equal(0.273000, loads_.target_total_load
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.163000, loads_.excess_total_load
(mce_gen_mdpt)[0]), file, line);
+
+ INVOKE_LMI_TEST(materially_equal(0.021000, loads_.premium_tax_load
()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.000000,
loads_.amortized_premium_tax_load ()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.005000, loads_.dac_tax_load
()[0]), file, line);
+
+ INVOKE_LMI_TEST(materially_equal(0.163000, loads_.target_total_load
(mce_gen_curr)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.103000, loads_.excess_total_load
(mce_gen_curr)[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.142000,
loads_.target_premium_load_excluding_premium_tax()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.082000,
loads_.excess_premium_load_excluding_premium_tax()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.164000,
loads_.target_premium_load_maximum_premium_tax ()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.104000,
loads_.excess_premium_load_maximum_premium_tax ()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.162000,
loads_.target_premium_load_minimum_premium_tax ()[0]), file, line);
+ INVOKE_LMI_TEST(materially_equal(0.102000,
loads_.excess_premium_load_minimum_premium_tax ()[0]), file, line);
}
int test_main(int, char*[])
diff --git a/map_lookup_test.cpp b/map_lookup_test.cpp
index 097a3be..8af79c7 100644
--- a/map_lookup_test.cpp
+++ b/map_lookup_test.cpp
@@ -32,9 +32,9 @@ int test_main(int, char*[])
polygons[4] = "square";
polygons[6] = "hexagon";
- BOOST_TEST_EQUAL("hexagon", map_lookup(polygons, 6));
+ LMI_TEST_EQUAL("hexagon", map_lookup(polygons, 6));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(map_lookup(polygons, 5)
,std::runtime_error
,"map_lookup: key '5' not found."
diff --git a/materially_equal_test.cpp b/materially_equal_test.cpp
index 2fda96e..cd5c2be 100644
--- a/materially_equal_test.cpp
+++ b/materially_equal_test.cpp
@@ -31,75 +31,75 @@ int test_main(int, char*[])
{
double epsilon = std::numeric_limits<double>::epsilon();
- BOOST_TEST( materially_equal(0.0, 0.0));
- BOOST_TEST( materially_equal(0.0, -0.0));
- BOOST_TEST(!materially_equal(0.0, epsilon));
+ LMI_TEST( materially_equal(0.0, 0.0));
+ LMI_TEST( materially_equal(0.0, -0.0));
+ LMI_TEST(!materially_equal(0.0, epsilon));
// https://lists.nongnu.org/archive/html/lmi/2018-02/msg00099.html
- BOOST_TEST(!materially_equal(0.0, 1e-100));
+ LMI_TEST(!materially_equal(0.0, 1e-100));
- BOOST_TEST( materially_equal(1, 1));
- BOOST_TEST(!materially_equal(1, 2));
+ LMI_TEST( materially_equal(1, 1));
+ LMI_TEST(!materially_equal(1, 2));
- BOOST_TEST( materially_equal(1.0, 1.0));
- BOOST_TEST(!materially_equal(1.0, 2.0));
+ LMI_TEST( materially_equal(1.0, 1.0));
+ LMI_TEST(!materially_equal(1.0, 2.0));
- BOOST_TEST(!materially_equal(epsilon, -epsilon));
+ LMI_TEST(!materially_equal(epsilon, -epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + epsilon, 0.0));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + epsilon, 0.0));
- BOOST_TEST( materially_equal( 1.0, 1.0 + 1.0E1 * epsilon));
- BOOST_TEST( materially_equal( 1.0, 1.0 + 1.0E2 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E3 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E4 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E5 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E6 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E7 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E8 * epsilon));
- BOOST_TEST(!materially_equal( 1.0, 1.0 + 1.0E9 * epsilon));
+ LMI_TEST( materially_equal( 1.0, 1.0 + 1.0E1 * epsilon));
+ LMI_TEST( materially_equal( 1.0, 1.0 + 1.0E2 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E3 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E4 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E5 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E6 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E7 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E8 * epsilon));
+ LMI_TEST(!materially_equal( 1.0, 1.0 + 1.0E9 * epsilon));
- BOOST_TEST( materially_equal(-1.0, -1.0 + 1.0E1 * epsilon));
- BOOST_TEST( materially_equal(-1.0, -1.0 + 1.0E2 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E3 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E4 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E5 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E6 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E7 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E8 * epsilon));
- BOOST_TEST(!materially_equal(-1.0, -1.0 + 1.0E9 * epsilon));
+ LMI_TEST( materially_equal(-1.0, -1.0 + 1.0E1 * epsilon));
+ LMI_TEST( materially_equal(-1.0, -1.0 + 1.0E2 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E3 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E4 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E5 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E6 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E7 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E8 * epsilon));
+ LMI_TEST(!materially_equal(-1.0, -1.0 + 1.0E9 * epsilon));
- BOOST_TEST(!materially_equal(1000000000.0, 1000000001.0));
- BOOST_TEST(!materially_equal(1000000000L , 1000000001L ));
+ LMI_TEST(!materially_equal(1000000000.0, 1000000001.0));
+ LMI_TEST(!materially_equal(1000000000L , 1000000001L ));
- BOOST_TEST( materially_equal(1000000000.0, 1000000001.0, 1.0E-9));
- BOOST_TEST( materially_equal(1000000000L , 1000000001L , 1.0E-9));
+ LMI_TEST( materially_equal(1000000000.0, 1000000001.0, 1.0E-9));
+ LMI_TEST( materially_equal(1000000000L , 1000000001L , 1.0E-9));
long double bignum = std::numeric_limits<long double>::max();
- BOOST_TEST( materially_equal(bignum, bignum, 0.0L ));
- BOOST_TEST( materially_equal(bignum, bignum, 1.0E-9L));
- BOOST_TEST( materially_equal(bignum, bignum, 1.0L ));
- BOOST_TEST( materially_equal(bignum, bignum, 1.0E9L ));
+ LMI_TEST( materially_equal(bignum, bignum, 0.0L ));
+ LMI_TEST( materially_equal(bignum, bignum, 1.0E-9L));
+ LMI_TEST( materially_equal(bignum, bignum, 1.0L ));
+ LMI_TEST( materially_equal(bignum, bignum, 1.0E9L ));
long double smallnum = std::numeric_limits<long double>::min();
- BOOST_TEST( materially_equal(smallnum, smallnum, 0.0L ));
- BOOST_TEST( materially_equal(smallnum, smallnum, 1.0E-9L));
- BOOST_TEST( materially_equal(smallnum, smallnum, 1.0L ));
- BOOST_TEST( materially_equal(smallnum, smallnum, 1.0E9L ));
+ LMI_TEST( materially_equal(smallnum, smallnum, 0.0L ));
+ LMI_TEST( materially_equal(smallnum, smallnum, 1.0E-9L));
+ LMI_TEST( materially_equal(smallnum, smallnum, 1.0L ));
+ LMI_TEST( materially_equal(smallnum, smallnum, 1.0E9L ));
long double infinity = std::numeric_limits<long double>::infinity();
- BOOST_TEST( materially_equal(infinity, infinity, 0.0L ));
- BOOST_TEST( materially_equal(infinity, infinity, 1.0E-9L));
- BOOST_TEST( materially_equal(infinity, infinity, 1.0L ));
- BOOST_TEST( materially_equal(infinity, infinity, 1.0E9L ));
+ LMI_TEST( materially_equal(infinity, infinity, 0.0L ));
+ LMI_TEST( materially_equal(infinity, infinity, 1.0E-9L));
+ LMI_TEST( materially_equal(infinity, infinity, 1.0L ));
+ LMI_TEST( materially_equal(infinity, infinity, 1.0E9L ));
- BOOST_TEST( materially_equal(bignum , bignum , smallnum));
- BOOST_TEST( materially_equal(infinity, infinity, smallnum));
- BOOST_TEST( materially_equal(smallnum, smallnum, bignum ));
- BOOST_TEST( materially_equal(infinity, infinity, bignum ));
- BOOST_TEST( materially_equal(bignum , bignum , infinity));
- BOOST_TEST( materially_equal(smallnum, smallnum, infinity));
+ LMI_TEST( materially_equal(bignum , bignum , smallnum));
+ LMI_TEST( materially_equal(infinity, infinity, smallnum));
+ LMI_TEST( materially_equal(smallnum, smallnum, bignum ));
+ LMI_TEST( materially_equal(infinity, infinity, bignum ));
+ LMI_TEST( materially_equal(bignum , bignum , infinity));
+ LMI_TEST( materially_equal(smallnum, smallnum, infinity));
- BOOST_TEST( materially_equal(0.0L ,-0.0L , smallnum));
- BOOST_TEST( materially_equal(smallnum,-smallnum, 3.0L ));
+ LMI_TEST( materially_equal(0.0L ,-0.0L , smallnum));
+ LMI_TEST( materially_equal(smallnum,-smallnum, 3.0L ));
// NaNs should always compare unequal, at least for compilers
// that claim to implement them properly.
@@ -110,16 +110,16 @@ int test_main(int, char*[])
if(quiet_NaN == quiet_NaN)
{
std::cout << "Defective compiler: qNaNs compare equal" <<
std::endl;
- BOOST_TEST( quiet_NaN != quiet_NaN );
+ LMI_TEST( quiet_NaN != quiet_NaN );
}
else
{
- BOOST_TEST( quiet_NaN != quiet_NaN );
- BOOST_TEST(!(quiet_NaN == quiet_NaN));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 0.0 ));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E-9));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0 ));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E9 ));
+ LMI_TEST( quiet_NaN != quiet_NaN );
+ LMI_TEST(!(quiet_NaN == quiet_NaN));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 0.0 ));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E-9));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0 ));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E9 ));
}
}
@@ -129,40 +129,40 @@ int test_main(int, char*[])
if(quiet_NaN == quiet_NaN)
{
std::cout << "Defective compiler: qNaNs compare equal" <<
std::endl;
- BOOST_TEST( quiet_NaN != quiet_NaN );
+ LMI_TEST( quiet_NaN != quiet_NaN );
}
else
{
- BOOST_TEST( quiet_NaN != quiet_NaN );
- BOOST_TEST(!(quiet_NaN == quiet_NaN));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 0.0L ));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E-9L));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0L ));
- BOOST_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E9L ));
+ LMI_TEST( quiet_NaN != quiet_NaN );
+ LMI_TEST(!(quiet_NaN == quiet_NaN));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 0.0L ));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E-9L));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0L ));
+ LMI_TEST(!materially_equal(quiet_NaN, quiet_NaN, 1.0E9L ));
}
}
// Test material_difference().
- BOOST_TEST_EQUAL( 0.0, material_difference(0.0, 0.0));
- BOOST_TEST_EQUAL( 0.0, material_difference(1.1, 1.1));
- BOOST_TEST_EQUAL( 1.1, material_difference(1.1, 0.0));
- BOOST_TEST_EQUAL(-1.1, material_difference(0.0, 1.1));
+ LMI_TEST_EQUAL( 0.0, material_difference(0.0, 0.0));
+ LMI_TEST_EQUAL( 0.0, material_difference(1.1, 1.1));
+ LMI_TEST_EQUAL( 1.1, material_difference(1.1, 0.0));
+ LMI_TEST_EQUAL(-1.1, material_difference(0.0, 1.1));
// https://lists.nongnu.org/archive/html/lmi/2018-02/msg00099.html
- BOOST_TEST_UNEQUAL(0.0, material_difference(0.0, 1e-100));
+ LMI_TEST_UNEQUAL(0.0, material_difference(0.0, 1e-100));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(0.0
,material_difference(1234567890.123456789, 1234567890.123456789)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(0.0
,material_difference(1234567890.123456789, 1234567890.1234)
);
- BOOST_TEST_UNEQUAL
+ LMI_TEST_UNEQUAL
(0.0
,material_difference(1234567890.123456789, 1234567890.123)
);
diff --git a/math_functions_test.cpp b/math_functions_test.cpp
index cf7c283..1267823 100644
--- a/math_functions_test.cpp
+++ b/math_functions_test.cpp
@@ -262,63 +262,63 @@ int test_main(int, char*[])
// Test mean<>().
- BOOST_TEST_EQUAL(1.5, mean<double>()(1.0, 2.0));
- BOOST_TEST_EQUAL(smallnumD, mean<double>()(smallnumD, smallnumD));
- BOOST_TEST_EQUAL(bignumD , mean<double>()(bignumD , bignumD ));
+ LMI_TEST_EQUAL(1.5, mean<double>()(1.0, 2.0));
+ LMI_TEST_EQUAL(smallnumD, mean<double>()(smallnumD, smallnumD));
+ LMI_TEST_EQUAL(bignumD , mean<double>()(bignumD , bignumD ));
- BOOST_TEST_EQUAL(1.5, mean<long double>()(1.0, 2.0));
- BOOST_TEST_EQUAL(smallnumL, mean<long double>()(smallnumL, smallnumL));
- BOOST_TEST_EQUAL(bignumL , mean<long double>()(bignumL , bignumL ));
+ LMI_TEST_EQUAL(1.5, mean<long double>()(1.0, 2.0));
+ LMI_TEST_EQUAL(smallnumL, mean<long double>()(smallnumL, smallnumL));
+ LMI_TEST_EQUAL(bignumL , mean<long double>()(bignumL , bignumL ));
// Test outward_quotient().
- BOOST_TEST_EQUAL( 1, outward_quotient( 2, 2));
- BOOST_TEST_EQUAL( 1, outward_quotient( 1, 2));
- BOOST_TEST_EQUAL( 0, outward_quotient( 0, 2));
- BOOST_TEST_EQUAL(-1, outward_quotient(-1, 2));
- BOOST_TEST_EQUAL(-1, outward_quotient(-2, 2));
-
- BOOST_TEST_EQUAL(-1, outward_quotient( 2, -2));
- BOOST_TEST_EQUAL(-1, outward_quotient( 1, -2));
- BOOST_TEST_EQUAL( 0, outward_quotient( 0, -2));
- BOOST_TEST_EQUAL( 1, outward_quotient(-1, -2));
- BOOST_TEST_EQUAL( 1, outward_quotient(-2, -2));
-
- BOOST_TEST_EQUAL( 0ULL, outward_quotient( 0ULL, 2ULL));
- BOOST_TEST_EQUAL( 1ULL, outward_quotient( 1ULL, 2ULL));
- BOOST_TEST_EQUAL( 1ULL, outward_quotient( 2ULL, 2ULL));
-
- BOOST_TEST_EQUAL( 0, outward_quotient( 0, 3));
- BOOST_TEST_EQUAL( 1, outward_quotient( 1, 3));
- BOOST_TEST_EQUAL( 1, outward_quotient( 2, 3));
- BOOST_TEST_EQUAL( 1, outward_quotient( 3, 3));
- BOOST_TEST_EQUAL( 2, outward_quotient( 4, 3));
- BOOST_TEST_EQUAL( 2, outward_quotient( 5, 3));
- BOOST_TEST_EQUAL( 2, outward_quotient( 6, 3));
- BOOST_TEST_EQUAL( 3, outward_quotient( 7, 3));
-
- BOOST_TEST_EQUAL(INT_MIN, outward_quotient(INT_MIN, 1));
- BOOST_TEST_EQUAL( 1, outward_quotient(INT_MIN, INT_MIN));
- BOOST_TEST_EQUAL( -1, outward_quotient( 1, INT_MIN));
-
- BOOST_TEST_EQUAL(INT_MAX, outward_quotient(INT_MAX, 1));
- BOOST_TEST_EQUAL( 1, outward_quotient(INT_MAX, INT_MAX));
- BOOST_TEST_EQUAL( 1, outward_quotient( 1, INT_MAX));
-
- BOOST_TEST_EQUAL(UINT_MAX, outward_quotient(UINT_MAX, 1u));
- BOOST_TEST_EQUAL( 1u, outward_quotient(UINT_MAX, UINT_MAX));
- BOOST_TEST_EQUAL( 1u, outward_quotient( 1u, UINT_MAX));
+ LMI_TEST_EQUAL( 1, outward_quotient( 2, 2));
+ LMI_TEST_EQUAL( 1, outward_quotient( 1, 2));
+ LMI_TEST_EQUAL( 0, outward_quotient( 0, 2));
+ LMI_TEST_EQUAL(-1, outward_quotient(-1, 2));
+ LMI_TEST_EQUAL(-1, outward_quotient(-2, 2));
+
+ LMI_TEST_EQUAL(-1, outward_quotient( 2, -2));
+ LMI_TEST_EQUAL(-1, outward_quotient( 1, -2));
+ LMI_TEST_EQUAL( 0, outward_quotient( 0, -2));
+ LMI_TEST_EQUAL( 1, outward_quotient(-1, -2));
+ LMI_TEST_EQUAL( 1, outward_quotient(-2, -2));
+
+ LMI_TEST_EQUAL( 0ULL, outward_quotient( 0ULL, 2ULL));
+ LMI_TEST_EQUAL( 1ULL, outward_quotient( 1ULL, 2ULL));
+ LMI_TEST_EQUAL( 1ULL, outward_quotient( 2ULL, 2ULL));
+
+ LMI_TEST_EQUAL( 0, outward_quotient( 0, 3));
+ LMI_TEST_EQUAL( 1, outward_quotient( 1, 3));
+ LMI_TEST_EQUAL( 1, outward_quotient( 2, 3));
+ LMI_TEST_EQUAL( 1, outward_quotient( 3, 3));
+ LMI_TEST_EQUAL( 2, outward_quotient( 4, 3));
+ LMI_TEST_EQUAL( 2, outward_quotient( 5, 3));
+ LMI_TEST_EQUAL( 2, outward_quotient( 6, 3));
+ LMI_TEST_EQUAL( 3, outward_quotient( 7, 3));
+
+ LMI_TEST_EQUAL(INT_MIN, outward_quotient(INT_MIN, 1));
+ LMI_TEST_EQUAL( 1, outward_quotient(INT_MIN, INT_MIN));
+ LMI_TEST_EQUAL( -1, outward_quotient( 1, INT_MIN));
+
+ LMI_TEST_EQUAL(INT_MAX, outward_quotient(INT_MAX, 1));
+ LMI_TEST_EQUAL( 1, outward_quotient(INT_MAX, INT_MAX));
+ LMI_TEST_EQUAL( 1, outward_quotient( 1, INT_MAX));
+
+ LMI_TEST_EQUAL(UINT_MAX, outward_quotient(UINT_MAX, 1u));
+ LMI_TEST_EQUAL( 1u, outward_quotient(UINT_MAX, UINT_MAX));
+ LMI_TEST_EQUAL( 1u, outward_quotient( 1u, UINT_MAX));
// The language allows "false/true"; this is no sillier.
- BOOST_TEST_EQUAL(false, outward_quotient(false, true));
+ LMI_TEST_EQUAL(false, outward_quotient(false, true));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(outward_quotient(1, 0)
,std::domain_error
,"Denominator is zero."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(outward_quotient(INT_MIN, -1)
,std::domain_error
,"Division might overflow."
@@ -334,21 +334,21 @@ int test_main(int, char*[])
// Test with 1 == 'n'.
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,i_upper_n_over_n_from_i<double,1>()(0.04)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,i_from_i_upper_n_over_n<double,1>()(0.04)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04 / 1.04
,d_upper_n_from_i<double,1>()(0.04)
@@ -357,9 +357,9 @@ int test_main(int, char*[])
// Test interest rate of -100%.
- BOOST_TEST_EQUAL(-1.0 , i_upper_12_over_12_from_i_naive<double>()(-1.0));
- BOOST_TEST_EQUAL(-1.0 , i_upper_12_over_12_from_i <double>()(-1.0));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(-1.0 , i_upper_12_over_12_from_i_naive<double>()(-1.0));
+ LMI_TEST_EQUAL(-1.0 , i_upper_12_over_12_from_i <double>()(-1.0));
+ LMI_TEST_THROW
(d_upper_12_from_i <double>()(-1.0)
,std::range_error
,"i equals -100%."
@@ -367,13 +367,13 @@ int test_main(int, char*[])
// Test nonsensical interest rate of -101%.
- BOOST_TEST(std::isnan(i_upper_12_over_12_from_i_naive<double>()(-1.01)));
- BOOST_TEST_THROW
+ LMI_TEST(std::isnan(i_upper_12_over_12_from_i_naive<double>()(-1.01)));
+ LMI_TEST_THROW
(i_upper_12_over_12_from_i<double>()(-1.01)
,std::domain_error
,"i is less than -100%."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(d_upper_12_from_i <double>()(-1.01)
,std::domain_error
,"i is less than -100%."
@@ -381,14 +381,14 @@ int test_main(int, char*[])
// Gross should equal net if decrements are both zero.
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,net_i_from_gross_naive<double,365>()(0.04, 0.0, 0.0)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,net_i_from_gross<double,365>()(0.04, 0.0, 0.0)
@@ -397,39 +397,39 @@ int test_main(int, char*[])
// Test exponential and power methods for approximate accuracy.
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.0032737397821988637 // Not very accurate.
,i_upper_12_over_12_from_i_naive<double>()(0.04)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.0032737397821988642
,i_upper_12_over_12_from_i<double>()(0.04)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,i_from_i_upper_12_over_12_naive<double>()(0.0032737397821988642)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.04
,i_from_i_upper_12_over_12<double>()(0.0032737397821988642)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.039156688577251846
,d_upper_12_from_i_naive<double>()(0.04)
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.039156688577251846
,d_upper_12_from_i<double>()(0.04)
@@ -441,14 +441,14 @@ int test_main(int, char*[])
// method. In this example, the former has a relative error
// on the order of 1e-15; the latter, only 1e-13 .
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.001
,net_i_from_gross_naive<double,365>()(0.001, 0.0, 0.0)
,1.0e-13
)
);
- BOOST_TEST
+ LMI_TEST
(!materially_equal
(0.001
,net_i_from_gross_naive<double,365>()(0.001, 0.0, 0.0)
@@ -456,7 +456,7 @@ int test_main(int, char*[])
)
);
- BOOST_TEST
+ LMI_TEST
(materially_equal
(0.001
,net_i_from_gross<double,365>()(0.001, 0.0, 0.0)
diff --git a/mc_enum_test.cpp b/mc_enum_test.cpp
index 2cfefff..e9c62ab 100644
--- a/mc_enum_test.cpp
+++ b/mc_enum_test.cpp
@@ -50,123 +50,123 @@ void mc_enum_test::test()
{
// Default ctor.
e_holiday holiday0;
- BOOST_TEST_EQUAL("Theophany", holiday0);
+ LMI_TEST_EQUAL("Theophany", holiday0);
// Construct from enumerator.
e_holiday holiday1(h_Easter);
- BOOST_TEST_EQUAL(holiday1, "Easter");
+ LMI_TEST_EQUAL(holiday1, "Easter");
// Construct from std::string.
std::string const s_Pentecost("Pentecost");
e_holiday holiday2(s_Pentecost);
- BOOST_TEST_EQUAL(holiday2, "Pentecost");
+ LMI_TEST_EQUAL(holiday2, "Pentecost");
// Construct from char const* implicitly converted to std::string.
e_holiday holiday3("Pentecost");
- BOOST_TEST_EQUAL(holiday3, "Pentecost");
+ LMI_TEST_EQUAL(holiday3, "Pentecost");
// Copy ctor.
e_holiday holiday4(holiday1);
- BOOST_TEST_EQUAL(holiday4, "Easter");
+ LMI_TEST_EQUAL(holiday4, "Easter");
// Copy assignment operator.
holiday4 = holiday2;
- BOOST_TEST_EQUAL(holiday4, "Pentecost");
+ LMI_TEST_EQUAL(holiday4, "Pentecost");
// Assign from enumerator.
holiday4 = h_Theophany;
- BOOST_TEST_EQUAL(holiday4, "Theophany");
+ LMI_TEST_EQUAL(holiday4, "Theophany");
// Assign from std::string.
holiday4 = s_Pentecost;
- BOOST_TEST_EQUAL(holiday4, "Pentecost");
+ LMI_TEST_EQUAL(holiday4, "Pentecost");
// Assign from char const* implicitly converted to std::string.
holiday4 = "Easter";
- BOOST_TEST_EQUAL(holiday4, "Easter");
+ LMI_TEST_EQUAL(holiday4, "Easter");
// Equivalence to same type.
- BOOST_TEST_EQUAL(holiday4, holiday1);
+ LMI_TEST_EQUAL(holiday4, holiday1);
// Equivalence to enumerator.
- BOOST_TEST_EQUAL(holiday4, h_Easter);
+ LMI_TEST_EQUAL(holiday4, h_Easter);
// Equivalence to std::string.
std::string const s_Easter("Easter");
- BOOST_TEST_EQUAL(holiday4, s_Easter);
+ LMI_TEST_EQUAL(holiday4, s_Easter);
// Equivalence to char const* implicitly converted to std::string.
- BOOST_TEST_EQUAL(holiday4, "Easter");
+ LMI_TEST_EQUAL(holiday4, "Easter");
// Operators added by boost::equality_comparable.
- BOOST_TEST_EQUAL (h_Easter, holiday4);
- BOOST_TEST_EQUAL (s_Easter, holiday4);
- BOOST_TEST_EQUAL ("Easter", holiday4);
- BOOST_TEST_UNEQUAL(holiday3, holiday4);
- BOOST_TEST_UNEQUAL(h_Pentecost, holiday4);
- BOOST_TEST_UNEQUAL(s_Pentecost, holiday4);
- BOOST_TEST_UNEQUAL("Pentecost", holiday4);
+ LMI_TEST_EQUAL (h_Easter, holiday4);
+ LMI_TEST_EQUAL (s_Easter, holiday4);
+ LMI_TEST_EQUAL ("Easter", holiday4);
+ LMI_TEST_UNEQUAL(holiday3, holiday4);
+ LMI_TEST_UNEQUAL(h_Pentecost, holiday4);
+ LMI_TEST_UNEQUAL(s_Pentecost, holiday4);
+ LMI_TEST_UNEQUAL("Pentecost", holiday4);
// Ordinal.
- BOOST_TEST_EQUAL(holiday4.ordinal(), 1);
+ LMI_TEST_EQUAL(holiday4.ordinal(), 1);
// Explicit conversion to std::string.
- BOOST_TEST_EQUAL(holiday4.str(), "Easter");
+ LMI_TEST_EQUAL(holiday4.str(), "Easter");
// Explicit conversion to enumerator.
- BOOST_TEST_EQUAL(holiday4.value(), h_Easter);
+ LMI_TEST_EQUAL(holiday4.value(), h_Easter);
// Cardinality.
- BOOST_TEST_EQUAL(holiday4.cardinality(), 3);
+ LMI_TEST_EQUAL(holiday4.cardinality(), 3);
mc_enum_base* base_pointer = dynamic_cast<mc_enum_base*>(&holiday4);
- BOOST_TEST(nullptr != base_pointer);
+ LMI_TEST(nullptr != base_pointer);
int expected_cardinality = 0;
if(base_pointer)
{
expected_cardinality = base_pointer->cardinality();
}
- BOOST_TEST_EQUAL(expected_cardinality, 3);
+ LMI_TEST_EQUAL(expected_cardinality, 3);
// Strings.
- BOOST_TEST_EQUAL("Theophany", holiday4.str(0));
- BOOST_TEST_EQUAL("Easter" , holiday4.str(1));
- BOOST_TEST_EQUAL("Pentecost", holiday4.str(2));
+ LMI_TEST_EQUAL("Theophany", holiday4.str(0));
+ LMI_TEST_EQUAL("Easter" , holiday4.str(1));
+ LMI_TEST_EQUAL("Pentecost", holiday4.str(2));
std::vector<std::string> v;
v.push_back(holiday4.str(0));
v.push_back(holiday4.str(1));
v.push_back(holiday4.str(2));
- BOOST_TEST(v == all_strings<enum_holiday>());
- BOOST_TEST(v == holiday4.all_strings());
+ LMI_TEST(v == all_strings<enum_holiday>());
+ LMI_TEST(v == holiday4.all_strings());
// Forced validity.
holiday3.enforce_proscription();
- BOOST_TEST_EQUAL(holiday3, "Pentecost");
+ LMI_TEST_EQUAL(holiday3, "Pentecost");
// If current value isn't allowed, pick the first one that is.
holiday3.allow(2, false);
- BOOST_TEST(!holiday3.is_allowed(2));
- BOOST_TEST( holiday4.is_allowed(2));
- BOOST_TEST_EQUAL(holiday3, "Pentecost");
+ LMI_TEST(!holiday3.is_allowed(2));
+ LMI_TEST( holiday4.is_allowed(2));
+ LMI_TEST_EQUAL(holiday3, "Pentecost");
holiday3.enforce_proscription();
- BOOST_TEST_EQUAL(holiday3, "Theophany");
+ LMI_TEST_EQUAL(holiday3, "Theophany");
holiday3.allow(0, false);
- BOOST_TEST_EQUAL(holiday3, "Theophany");
+ LMI_TEST_EQUAL(holiday3, "Theophany");
holiday3.enforce_proscription();
- BOOST_TEST_EQUAL(holiday3, "Easter");
+ LMI_TEST_EQUAL(holiday3, "Easter");
// If no value is allowed, pick the current ordinal.
holiday3.allow(1, false);
- BOOST_TEST_EQUAL(holiday3, "Easter");
+ LMI_TEST_EQUAL(holiday3, "Easter");
holiday3.enforce_proscription();
- BOOST_TEST_EQUAL(holiday3, "Easter");
+ LMI_TEST_EQUAL(holiday3, "Easter");
// That which is inconceivable is not to be allowed.
// COMPILER !! Here, como catches std::range_error when at()
// throws, whereas 23.1.1/13 requires std::out_of_range.
- BOOST_TEST_THROW(holiday3.allow( 3, false), std::out_of_range, "");
- BOOST_TEST_THROW(holiday3.allow(17, false), std::out_of_range, "");
- BOOST_TEST_THROW(holiday3.allow(-1, false), std::out_of_range, "");
+ LMI_TEST_THROW(holiday3.allow( 3, false), std::out_of_range, "");
+ LMI_TEST_THROW(holiday3.allow(17, false), std::out_of_range, "");
+ LMI_TEST_THROW(holiday3.allow(-1, false), std::out_of_range, "");
// Stream operators.
e_holiday const Easter(h_Easter);
@@ -174,20 +174,20 @@ void mc_enum_test::test()
std::stringstream ss;
ss << Easter;
ss >> holiday5;
- BOOST_TEST_EQUAL(Easter, holiday5);
+ LMI_TEST_EQUAL(Easter, holiday5);
ss.str("");
ss.clear();
e_holiday const Pentecost(h_Pentecost);
ss << Pentecost;
ss >> holiday5;
- BOOST_TEST_EQUAL(Pentecost, holiday5);
+ LMI_TEST_EQUAL(Pentecost, holiday5);
// Test an enumerative class that has a std::string name that
// matches one in a different enumerative class.
e_island island0;
- BOOST_TEST_EQUAL("Easter", island0);
- BOOST_TEST_EQUAL(i_Easter, island0);
+ LMI_TEST_EQUAL("Easter", island0);
+ LMI_TEST_EQUAL(i_Easter, island0);
// Streaming shouldn't stop reading at blanks, which are not
// treated as whitespace.
@@ -196,7 +196,7 @@ void mc_enum_test::test()
ss.str("");
ss << island1;
ss >> island1;
- BOOST_TEST_EQUAL("Pago Pago", island1);
+ LMI_TEST_EQUAL("Pago Pago", island1);
// A long time ago, a predecessor of this class replaced spaces
// with underbars in its stream inserter. To maintain backward
@@ -206,7 +206,7 @@ void mc_enum_test::test()
ss.clear();
ss.str("Pago_Pago");
ss >> island2;
- BOOST_TEST_EQUAL("Pago Pago", island2);
+ LMI_TEST_EQUAL("Pago Pago", island2);
// Backward compatibility, however, must not come at the expense
// of correctness. Underbars can legitimately appear in strings
@@ -216,9 +216,9 @@ void mc_enum_test::test()
ss.clear();
ss.str("Ni_ihau");
ss >> island3;
- BOOST_TEST_EQUAL("Ni_ihau", island3);
+ LMI_TEST_EQUAL("Ni_ihau", island3);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(e_island unknown("Borneo")
,std::runtime_error
,""
@@ -230,7 +230,7 @@ void mc_enum_test::test_product_name()
std::stringstream ss;
ss.str("invalid product");
ce_product_name x;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(ss >> x
,std::runtime_error
,"Value 'invalid product' invalid for type 'ce_product_name'."
diff --git a/md5sum_test.cpp b/md5sum_test.cpp
index 309e603..cdc4023 100644
--- a/md5sum_test.cpp
+++ b/md5sum_test.cpp
@@ -153,42 +153,42 @@ void MD5SumTest::TestMD5Calculation() const
{
// Test md5_calculate_stream_checksum function.
std::ifstream is_text{test_filename, std::ios_base::in};
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(test_text_checksum
,md5_calculate_stream_checksum(is_text, test_filename)
);
std::ifstream is_bin{test_filename, ios_in_binary()};
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(test_bin_checksum
,md5_calculate_stream_checksum(is_bin, test_filename)
);
std::istringstream is_fail{test_text, std::ios_base::in};
is_fail.setstate(std::ios_base::failbit);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_calculate_stream_checksum(is_fail, test_filename)
,std::runtime_error
,"'md5_file': failed to read data while computing md5sum"
);
// Test md5_calculate_file_checksum function.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(test_text_checksum
,md5_calculate_file_checksum(test_filename, md5_file_mode::text)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(test_bin_checksum
,md5_calculate_file_checksum(test_filename, md5_file_mode::binary)
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(md5_calculate_file_checksum(md5sums_filename, md5_file_mode::text)
,md5_calculate_file_checksum(md5sums_filename, md5_file_mode::binary)
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_calculate_file_checksum("_ghost_")
,std::runtime_error
,"'_ghost_': no such file or directory"
@@ -207,43 +207,43 @@ void MD5SumTest::TestMD5Reading() const
// Test md5_read_checksum_stream function.
std::istringstream is_sums{md5sums_text};
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(md5sums
,md5_read_checksum_stream(is_sums, md5sums_filename)
);
std::istringstream is_throw1{"00112233445566778899aabbccddeeff \n"};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_read_checksum_stream(is_throw1, "test1")
,std::runtime_error
,"'test1': line too short at line 1"
);
std::istringstream is_throw2{"00112233445566778899aabbccddeeff_test\n"};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_read_checksum_stream(is_throw2, "test2")
,std::runtime_error
,"'test2': incorrect checksum line format at line 1"
);
std::istringstream is_throw3{"00112233445566778899aabbccddeeff test\n"};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_read_checksum_stream(is_throw3, "test3")
,std::runtime_error
,"'test3': incorrect checksum line format at line 1"
);
std::istringstream is_throw4{"00112233445566778899aabbccddee test\n"};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_read_checksum_stream(is_throw4, "test4")
,std::runtime_error
,"'test4': incorrect MD5 sum format at line 1"
);
// Test md5_read_checksum_file function.
- BOOST_TEST_EQUAL(md5sums, md5_read_checksum_file(md5sums_filename));
+ LMI_TEST_EQUAL(md5sums, md5_read_checksum_file(md5sums_filename));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(md5_read_checksum_file("_ghost_")
,std::runtime_error
,"'_ghost_': no such file or directory"
@@ -258,7 +258,7 @@ void MD5SumTest::TestMD5ToHexString() const
{0x0f, 0x1e, 0x2d, 0x3c, 0x4b, 0x5a, 0x69, 0x78
,0x87, 0x96, 0xa5, 0xb4, 0xc3, 0xd2, 0xe1, 0xf0
};
- BOOST_TEST_EQUAL("0f1e2d3c4b5a69788796a5b4c3d2e1f0", md5_hex_string(v));
+ LMI_TEST_EQUAL("0f1e2d3c4b5a69788796a5b4c3d2e1f0", md5_hex_string(v));
}
void MD5SumTest::RemoveTestFilesIfNecessary(char const* file, int line) const
@@ -267,7 +267,7 @@ void MD5SumTest::RemoveTestFilesIfNecessary(char const*
file, int line) const
{
if(fs::exists(filename))
{
- INVOKE_BOOST_TEST(std::remove(filename) == 0, file, line);
+ INVOKE_LMI_TEST(std::remove(filename) == 0, file, line);
}
};
@@ -287,18 +287,18 @@ void MD5SumTest::WriteAndCheckFile
) const
{
std::ofstream os{filename, ios_out_trunc_binary()};
- INVOKE_BOOST_TEST(os.good(), file, line);
+ INVOKE_LMI_TEST(os.good(), file, line);
os << text;
os.close();
// Read the file back.
std::ifstream is{filename, ios_in_binary()};
- INVOKE_BOOST_TEST(is.good(), file, line);
+ INVOKE_LMI_TEST(is.good(), file, line);
std::ostringstream oss;
oss << is.rdbuf();
is.close();
- INVOKE_BOOST_TEST_EQUAL(text, oss.str(), file, line);
+ INVOKE_LMI_TEST_EQUAL(text, oss.str(), file, line);
}
/// Write a text file for testing.
diff --git a/miscellany_test.cpp b/miscellany_test.cpp
index 4091bbd..54d5803 100644
--- a/miscellany_test.cpp
+++ b/miscellany_test.cpp
@@ -44,45 +44,45 @@ void test_each_equal()
// Test with containers.
- BOOST_TEST( each_equal(a0, 0));
- BOOST_TEST(!each_equal(a1, 0));
- BOOST_TEST(!each_equal(a2, 0));
- BOOST_TEST(!each_equal(a3, 0));
+ LMI_TEST( each_equal(a0, 0));
+ LMI_TEST(!each_equal(a1, 0));
+ LMI_TEST(!each_equal(a2, 0));
+ LMI_TEST(!each_equal(a3, 0));
- BOOST_TEST( each_equal(v0, 0));
- BOOST_TEST(!each_equal(v1, 0));
- BOOST_TEST(!each_equal(v2, 0));
- BOOST_TEST(!each_equal(v3, 0));
+ LMI_TEST( each_equal(v0, 0));
+ LMI_TEST(!each_equal(v1, 0));
+ LMI_TEST(!each_equal(v2, 0));
+ LMI_TEST(!each_equal(v3, 0));
// Test with iterators.
- BOOST_TEST( each_equal(v0.begin(), v0.end(), 0));
- BOOST_TEST(!each_equal(v1.begin(), v1.end(), 0));
- BOOST_TEST(!each_equal(v2.begin(), v2.end(), 0));
- BOOST_TEST(!each_equal(v3.begin(), v3.end(), 0));
+ LMI_TEST( each_equal(v0.begin(), v0.end(), 0));
+ LMI_TEST(!each_equal(v1.begin(), v1.end(), 0));
+ LMI_TEST(!each_equal(v2.begin(), v2.end(), 0));
+ LMI_TEST(!each_equal(v3.begin(), v3.end(), 0));
// Iterators are more flexible, of course.
- BOOST_TEST( each_equal(v0.begin() + 0, v0.end(), 0));
- BOOST_TEST( each_equal(v1.begin() + 1, v1.end(), 1));
- BOOST_TEST( each_equal(v2.begin() + 2, v2.end(), 2));
- BOOST_TEST( each_equal(v3.begin() + 3, v3.end(), 3));
+ LMI_TEST( each_equal(v0.begin() + 0, v0.end(), 0));
+ LMI_TEST( each_equal(v1.begin() + 1, v1.end(), 1));
+ LMI_TEST( each_equal(v2.begin() + 2, v2.end(), 2));
+ LMI_TEST( each_equal(v3.begin() + 3, v3.end(), 3));
// Iterators are also more prone to error. The following examples
// have undefined behavior.
-// BOOST_TEST( each_equal(v0.begin() + 7, v0.end(), 0));
-// BOOST_TEST( each_equal(v0.begin() , v3.end(), 0));
+// LMI_TEST( each_equal(v0.begin() + 7, v0.end(), 0));
+// LMI_TEST( each_equal(v0.begin() , v3.end(), 0));
// Test empty ranges. There can be no empty array [8.3.4/1].
// By arbitrary definition, any value compares equal to an empty
// range.
- BOOST_TEST( each_equal(v0.end(), v0.end(), 0)); // both end()
- BOOST_TEST( each_equal(v0.end(), v0.end(), 12345)); // both end()
+ LMI_TEST( each_equal(v0.end(), v0.end(), 0)); // both end()
+ LMI_TEST( each_equal(v0.end(), v0.end(), 12345)); // both end()
std::vector<int> v_empty;
- BOOST_TEST( each_equal(v_empty, 23456));
- BOOST_TEST( each_equal(v_empty.begin(), v_empty.end(), 34567));
+ LMI_TEST( each_equal(v_empty, 23456));
+ LMI_TEST( each_equal(v_empty.begin(), v_empty.end(), 34567));
}
void test_files_are_identical()
@@ -94,7 +94,7 @@ void test_files_are_identical()
std::remove(f1);
// Nonexistent files.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(files_are_identical(f0, f1)
,std::runtime_error
,"Unable to open 'unlikely_file_name_0'."
@@ -105,7 +105,7 @@ void test_files_are_identical()
std::ofstream ofs0(f0, ios_out_trunc_binary());
std::ofstream ofs1(f1, ios_out_trunc_binary());
}
- BOOST_TEST(files_are_identical(f0, f1));
+ LMI_TEST(files_are_identical(f0, f1));
// Identical nonempty files.
{
@@ -114,7 +114,7 @@ void test_files_are_identical()
ofs0 << "Test";
ofs1 << "Test";
}
- BOOST_TEST(files_are_identical(f0, f1));
+ LMI_TEST(files_are_identical(f0, f1));
// Files whose contents might be identical in text mode but differ
// in binary mode are nonidentical.
@@ -124,7 +124,7 @@ void test_files_are_identical()
ofs0 << "Test\r\n";
ofs1 << "Test\n";
}
- BOOST_TEST(!files_are_identical(f0, f1));
+ LMI_TEST(!files_are_identical(f0, f1));
std::remove(f0);
std::remove(f1);
@@ -142,73 +142,73 @@ void test_minmax()
// Test const-correctness.
std::vector<double> const v = w;
minmax<double> const m(v);
- BOOST_TEST(zero == m.minimum());
- BOOST_TEST(one == m.maximum());
+ LMI_TEST(zero == m.minimum());
+ LMI_TEST(one == m.maximum());
// Motivation for relational operators: to write this...
- BOOST_TEST(zero <= m.minimum() && m.maximum() <= one);
+ LMI_TEST(zero <= m.minimum() && m.maximum() <= one);
// ...more compactly:
- BOOST_TEST( zero <= m && m <= one );
- BOOST_TEST(!(zero < m || m < one));
+ LMI_TEST( zero <= m && m <= one );
+ LMI_TEST(!(zero < m || m < one));
}
void test_prefix_and_suffix()
{
std::string s = "";
- BOOST_TEST( begins_with(s, ""));
- BOOST_TEST( ends_with (s, ""));
+ LMI_TEST( begins_with(s, ""));
+ LMI_TEST( ends_with (s, ""));
- BOOST_TEST(!begins_with(s, "A"));
- BOOST_TEST(!ends_with (s, "Z"));
+ LMI_TEST(!begins_with(s, "A"));
+ LMI_TEST(!ends_with (s, "Z"));
- BOOST_TEST(!begins_with(s, "ABC"));
- BOOST_TEST(!ends_with (s, "XYZ"));
+ LMI_TEST(!begins_with(s, "ABC"));
+ LMI_TEST(!ends_with (s, "XYZ"));
s = "W";
- BOOST_TEST( begins_with(s, ""));
- BOOST_TEST( ends_with (s, ""));
+ LMI_TEST( begins_with(s, ""));
+ LMI_TEST( ends_with (s, ""));
- BOOST_TEST(!begins_with(s, "A"));
- BOOST_TEST(!ends_with (s, "Z"));
+ LMI_TEST(!begins_with(s, "A"));
+ LMI_TEST(!ends_with (s, "Z"));
- BOOST_TEST(!begins_with(s, "WW"));
- BOOST_TEST(!ends_with (s, "WW"));
+ LMI_TEST(!begins_with(s, "WW"));
+ LMI_TEST(!ends_with (s, "WW"));
- BOOST_TEST( begins_with(s, "W"));
- BOOST_TEST( ends_with (s, "W"));
+ LMI_TEST( begins_with(s, "W"));
+ LMI_TEST( ends_with (s, "W"));
s = "LMNOP";
- BOOST_TEST( begins_with(s, ""));
- BOOST_TEST( ends_with (s, ""));
+ LMI_TEST( begins_with(s, ""));
+ LMI_TEST( ends_with (s, ""));
- BOOST_TEST(!begins_with(s, "A"));
- BOOST_TEST(!ends_with (s, "Z"));
+ LMI_TEST(!begins_with(s, "A"));
+ LMI_TEST(!ends_with (s, "Z"));
- BOOST_TEST( begins_with(s, "L"));
- BOOST_TEST( ends_with (s, "P"));
+ LMI_TEST( begins_with(s, "L"));
+ LMI_TEST( ends_with (s, "P"));
- BOOST_TEST( begins_with(s, "LMN"));
- BOOST_TEST( ends_with (s, "NOP"));
+ LMI_TEST( begins_with(s, "LMN"));
+ LMI_TEST( ends_with (s, "NOP"));
- BOOST_TEST( begins_with(s, "LMNOP"));
- BOOST_TEST( ends_with (s, "LMNOP"));
+ LMI_TEST( begins_with(s, "LMNOP"));
+ LMI_TEST( ends_with (s, "LMNOP"));
- BOOST_TEST(!begins_with(s, "LMNOPQ"));
- BOOST_TEST(!ends_with (s, "KLMNOP"));
+ LMI_TEST(!begins_with(s, "LMNOPQ"));
+ LMI_TEST(!ends_with (s, "KLMNOP"));
}
void test_scale_power()
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(scale_power(0, 0.0, 0.0)
,std::runtime_error
,lmi_test::what_regex("^Assertion.*failed")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(scale_power(9, 1.0, -1.0)
,std::runtime_error
,lmi_test::what_regex("^Assertion.*failed")
@@ -217,7 +217,7 @@ void test_scale_power()
using D = std::numeric_limits<double>;
if(D::has_quiet_NaN)
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(scale_power(9, D::quiet_NaN(), D::quiet_NaN())
,std::runtime_error
,lmi_test::what_regex("^Assertion.*failed")
@@ -226,69 +226,69 @@ void test_scale_power()
if(D::has_infinity)
{
- BOOST_TEST_EQUAL( 0, scale_power( 9, D::infinity(),
D::infinity()));
+ LMI_TEST_EQUAL( 0, scale_power( 9, D::infinity(), D::infinity()));
}
// Test positive and negative zeros.
- BOOST_TEST_EQUAL( 0, scale_power( 9, 0.0,
0.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, 0.0,
999'999'999.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0,
0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, 0.0, 0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, 0.0, 999'999'999.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0, 0.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, -0.0,
-0.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, -0.0,
999'999'999.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0,
-0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -0.0, -0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -0.0, 999'999'999.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0, -0.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, 0.0,
-0.0));
- BOOST_TEST_EQUAL( 0, scale_power( 9, -0.0,
0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, 0.0, -0.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -0.0, 0.0));
// Test values for which rounding toward infinity crosses a threshold.
// 999,999,999.0 rounds to 999,999,999
- BOOST_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0,
999'999'999.0));
+ LMI_TEST_EQUAL( 0, scale_power( 9, -99'999'999.0, 999'999'999.0));
// However:
// 999,999.999.9 may round to 1,000,000,000; and
// -99,999,999.9 may round to -100,000,000
// which is equally wide if widths are reckoned as [,]:0 and [-0-9]:1
// (as for a monospace font with comma-less formatting).
// Test with such a maximal value on LHS, RHS, and both sides.
- BOOST_TEST_EQUAL( 3, scale_power( 9, -99'999'999.9,
999'999.9));
- BOOST_TEST_EQUAL( 3, scale_power( 9, -999'999.9,
999'999'999.9));
- BOOST_TEST_EQUAL( 3, scale_power( 9, -99'999'999.9,
999'999'999.9));
+ LMI_TEST_EQUAL( 3, scale_power( 9, -99'999'999.9, 999'999.9));
+ LMI_TEST_EQUAL( 3, scale_power( 9, -999'999.9, 999'999'999.9));
+ LMI_TEST_EQUAL( 3, scale_power( 9, -99'999'999.9, 999'999'999.9));
// Test values of like sign in threshold neighborhood.
// both positive, below threshold
- BOOST_TEST_EQUAL( 6, scale_power( 6, 0.1,
999'999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 6, 123'456'789.0,
999'999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 6, 999'999'999'999.0,
999'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, 0.1, 999'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, 123'456'789.0, 999'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, 999'999'999'999.0, 999'999'999'999.0));
// both positive, threshold
- BOOST_TEST_EQUAL( 9, scale_power( 6, 0.1,
999'999'999'999.1));
- BOOST_TEST_EQUAL( 9, scale_power( 6, 123'456'789.0,
999'999'999'999.1));
- BOOST_TEST_EQUAL( 9, scale_power( 6, 999'999'999'999.0,
999'999'999'999.1));
- BOOST_TEST_EQUAL( 9, scale_power( 6, 999'999'999'999.1,
999'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 0.1, 999'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 123'456'789.0, 999'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 999'999'999'999.0, 999'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 999'999'999'999.1, 999'999'999'999.1));
// both negative, below threshold
- BOOST_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0,
-0.1));
- BOOST_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0,
-123'456'789.0));
- BOOST_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0,
-99'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0, -0.1));
+ LMI_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0, -123'456'789.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, -99'999'999'999.0, -99'999'999'999.0));
// both negative, threshold
- BOOST_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1,
-0.1));
- BOOST_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1,
-123'456'789.0));
- BOOST_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1,
-99'999'999'999.0));
- BOOST_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1,
-99'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1, -0.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1, -123'456'789.0));
+ LMI_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1, -99'999'999'999.0));
+ LMI_TEST_EQUAL( 9, scale_power( 6, -99'999'999'999.1, -99'999'999'999.1));
// Test threshold neighborhood for the scale_power=9 setting that
// is still hardcoded in lmi as this is written in 2018-03.
- BOOST_TEST_EQUAL( 0, scale_power( 9, 0.0,
999'999'999.0));
- BOOST_TEST_EQUAL( 3, scale_power( 9, 0.0,
999'999'999.1));
- BOOST_TEST_EQUAL( 3, scale_power( 9, 0.0,
999'999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 9, 0.0,
999'999'999'999.1));
- BOOST_TEST_EQUAL( 6, scale_power( 9, 0.0,
999'999'999'999'999.0));
- BOOST_TEST_EQUAL( 9, scale_power( 9, 0.0,
999'999'999'999'999.1));
+ LMI_TEST_EQUAL( 0, scale_power( 9, 0.0, 999'999'999.0));
+ LMI_TEST_EQUAL( 3, scale_power( 9, 0.0, 999'999'999.1));
+ LMI_TEST_EQUAL( 3, scale_power( 9, 0.0, 999'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 9, 0.0, 999'999'999'999.1));
+ LMI_TEST_EQUAL( 6, scale_power( 9, 0.0, 999'999'999'999'999.0));
+ LMI_TEST_EQUAL( 9, scale_power( 9, 0.0, 999'999'999'999'999.1));
// In the last test above, the threshold is not 999'999'999'999'999.01
// as the scale_power() algorithm, which rounds fractions toward
@@ -296,16 +296,16 @@ void test_scale_power()
// because 'binary64' doesn't have seventeen exact decimal digits.
// In this range, successive values show a granularity of 1/8:
- BOOST_TEST_EQUAL( 999'999'999'999'999 ,999'999'999'999'999.0);
- BOOST_TEST_EQUAL( 999'999'999'999'999.125 ,999'999'999'999'999.1);
- BOOST_TEST_EQUAL( 999'999'999'999'999.25 ,999'999'999'999'999.2);
- BOOST_TEST_EQUAL( 999'999'999'999'999.25 ,999'999'999'999'999.3);
- BOOST_TEST_EQUAL( 999'999'999'999'999.375 ,999'999'999'999'999.4);
- BOOST_TEST_EQUAL( 999'999'999'999'999.5 ,999'999'999'999'999.5);
- BOOST_TEST_EQUAL( 999'999'999'999'999.625 ,999'999'999'999'999.6);
- BOOST_TEST_EQUAL( 999'999'999'999'999.75 ,999'999'999'999'999.7);
- BOOST_TEST_EQUAL( 999'999'999'999'999.75 ,999'999'999'999'999.8);
- BOOST_TEST_EQUAL( 999'999'999'999'999.875 ,999'999'999'999'999.9);
+ LMI_TEST_EQUAL( 999'999'999'999'999 ,999'999'999'999'999.0);
+ LMI_TEST_EQUAL( 999'999'999'999'999.125 ,999'999'999'999'999.1);
+ LMI_TEST_EQUAL( 999'999'999'999'999.25 ,999'999'999'999'999.2);
+ LMI_TEST_EQUAL( 999'999'999'999'999.25 ,999'999'999'999'999.3);
+ LMI_TEST_EQUAL( 999'999'999'999'999.375 ,999'999'999'999'999.4);
+ LMI_TEST_EQUAL( 999'999'999'999'999.5 ,999'999'999'999'999.5);
+ LMI_TEST_EQUAL( 999'999'999'999'999.625 ,999'999'999'999'999.6);
+ LMI_TEST_EQUAL( 999'999'999'999'999.75 ,999'999'999'999'999.7);
+ LMI_TEST_EQUAL( 999'999'999'999'999.75 ,999'999'999'999'999.8);
+ LMI_TEST_EQUAL( 999'999'999'999'999.875 ,999'999'999'999'999.9);
// As more decimal triplets are added, exactness erodes. Between
// 2^52 = 4'503'599'627'370'496
@@ -316,47 +316,47 @@ void test_scale_power()
// the same is true of this 80-bit extended precision value:
// 2^64 = 18'446'744'073'709'551'616
// Thus, this test would fail for a 'binary64' double:
-// BOOST_TEST_EQUAL( 9, scale_power( 9, 0.0,
999'999'999'999'999'999.0));
+// LMI_TEST_EQUAL( 9, scale_power( 9, 0.0, 999'999'999'999'999'999.0));
// that value being indistinguishable from 1'000'000'000'000'000'000.0
// of which neither is representable exactly. The next several
// tests accidentally "work" as one might naively imagine...
- BOOST_TEST_EQUAL(12, scale_power( 9, 0.0,
999'999'999'999'999'999.1));
- BOOST_TEST_EQUAL(12, scale_power( 9, 0.0,
1'000'000'000'000'000'000.0));
- BOOST_TEST_EQUAL(15, scale_power( 9, 0.0,
1'000'000'000'000'000'000'000.0));
+ LMI_TEST_EQUAL(12, scale_power( 9, 0.0, 999'999'999'999'999'999.1));
+ LMI_TEST_EQUAL(12, scale_power( 9, 0.0, 1'000'000'000'000'000'000.0));
+ LMI_TEST_EQUAL(15, scale_power( 9, 0.0, 1'000'000'000'000'000'000'000.0));
// ...but this one happens not to...
-// BOOST_TEST_EQUAL(18, scale_power(9,0,
1'000'000'000'000'000'000'000'000.0));
+// LMI_TEST_EQUAL(18, scale_power(9,0, 1'000'000'000'000'000'000'000'000.0));
// ...just as this "worked" above...
-// BOOST_TEST_EQUAL( 9, scale_power( 9, 0.0,
999'999'999'999'999.1));
+// LMI_TEST_EQUAL( 9, scale_power( 9, 0.0, 999'999'999'999'999.1));
// but wouldn't have "worked" with the value 999'999'999'999'999.01
// Test threshold neighborhood for scale_power=8.
- BOOST_TEST_EQUAL( 0, scale_power( 8, 0.0,
99'999'999.0));
- BOOST_TEST_EQUAL( 3, scale_power( 8, 0.0,
99'999'999.1));
- BOOST_TEST_EQUAL( 3, scale_power( 8, 0.0,
99'999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 8, 0.0,
99'999'999'999.1));
- BOOST_TEST_EQUAL( 6, scale_power( 8, 0.0,
99'999'999'999'999.0));
- BOOST_TEST_EQUAL( 9, scale_power( 8, 0.0,
99'999'999'999'999.1));
+ LMI_TEST_EQUAL( 0, scale_power( 8, 0.0, 99'999'999.0));
+ LMI_TEST_EQUAL( 3, scale_power( 8, 0.0, 99'999'999.1));
+ LMI_TEST_EQUAL( 3, scale_power( 8, 0.0, 99'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 8, 0.0, 99'999'999'999.1));
+ LMI_TEST_EQUAL( 6, scale_power( 8, 0.0, 99'999'999'999'999.0));
+ LMI_TEST_EQUAL( 9, scale_power( 8, 0.0, 99'999'999'999'999.1));
// Test threshold neighborhood for scale_power=7.
- BOOST_TEST_EQUAL( 0, scale_power( 7, 0.0,
9'999'999.0));
- BOOST_TEST_EQUAL( 3, scale_power( 7, 0.0,
9'999'999.1));
- BOOST_TEST_EQUAL( 3, scale_power( 7, 0.0,
9'999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 7, 0.0,
9'999'999'999.1));
- BOOST_TEST_EQUAL( 6, scale_power( 7, 0.0,
9'999'999'999'999.0));
- BOOST_TEST_EQUAL( 9, scale_power( 7, 0.0,
9'999'999'999'999.1));
+ LMI_TEST_EQUAL( 0, scale_power( 7, 0.0, 9'999'999.0));
+ LMI_TEST_EQUAL( 3, scale_power( 7, 0.0, 9'999'999.1));
+ LMI_TEST_EQUAL( 3, scale_power( 7, 0.0, 9'999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 7, 0.0, 9'999'999'999.1));
+ LMI_TEST_EQUAL( 6, scale_power( 7, 0.0, 9'999'999'999'999.0));
+ LMI_TEST_EQUAL( 9, scale_power( 7, 0.0, 9'999'999'999'999.1));
// Test threshold neighborhood for scale_power=6.
- BOOST_TEST_EQUAL( 0, scale_power( 6, 0.0,
999'999.0));
- BOOST_TEST_EQUAL( 3, scale_power( 6, 0.0,
999'999.1));
- BOOST_TEST_EQUAL( 3, scale_power( 6, 0.0,
999'999'999.0));
- BOOST_TEST_EQUAL( 6, scale_power( 6, 0.0,
999'999'999.1));
- BOOST_TEST_EQUAL( 6, scale_power( 6, 0.0,
999'999'999'999.0));
- BOOST_TEST_EQUAL( 9, scale_power( 6, 0.0,
999'999'999'999.1));
- BOOST_TEST_EQUAL( 9, scale_power( 6, 0.0,
999'999'999'999'999.0));
- BOOST_TEST_EQUAL(12, scale_power( 6, 0.0,
999'999'999'999'999.1));
+ LMI_TEST_EQUAL( 0, scale_power( 6, 0.0, 999'999.0));
+ LMI_TEST_EQUAL( 3, scale_power( 6, 0.0, 999'999.1));
+ LMI_TEST_EQUAL( 3, scale_power( 6, 0.0, 999'999'999.0));
+ LMI_TEST_EQUAL( 6, scale_power( 6, 0.0, 999'999'999.1));
+ LMI_TEST_EQUAL( 6, scale_power( 6, 0.0, 999'999'999'999.0));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 0.0, 999'999'999'999.1));
+ LMI_TEST_EQUAL( 9, scale_power( 6, 0.0, 999'999'999'999'999.0));
+ LMI_TEST_EQUAL(12, scale_power( 6, 0.0, 999'999'999'999'999.1));
}
void test_trimming()
@@ -365,35 +365,35 @@ void test_trimming()
std::string s = "";
ltrim(s, superfluous); rtrim(s, superfluous);
- BOOST_TEST_EQUAL(s, "");
+ LMI_TEST_EQUAL(s, "");
s = " ";
ltrim(s, superfluous); rtrim(s, superfluous);
- BOOST_TEST_EQUAL(s, "");
+ LMI_TEST_EQUAL(s, "");
s = " ;; ";
ltrim(s, superfluous); rtrim(s, superfluous);
- BOOST_TEST_EQUAL(s, "");
+ LMI_TEST_EQUAL(s, "");
s = "a";
ltrim(s, superfluous); rtrim(s, superfluous);
- BOOST_TEST_EQUAL(s, "a");
+ LMI_TEST_EQUAL(s, "a");
s = "; ;a; ;";
ltrim(s, superfluous); rtrim(s, superfluous);
- BOOST_TEST_EQUAL(s, "a");
+ LMI_TEST_EQUAL(s, "a");
s = "a ; a ; ";
rtrim(s, superfluous); // Shows what rtrim() does.
- BOOST_TEST_EQUAL(s, "a ; a");
+ LMI_TEST_EQUAL(s, "a ; a");
ltrim(s, superfluous); rtrim(s, superfluous); // Does nothing, correctly.
- BOOST_TEST_EQUAL(s, "a ; a");
+ LMI_TEST_EQUAL(s, "a ; a");
s = "; a ; a";
ltrim(s, superfluous); // Shows what ltrim() does.
- BOOST_TEST_EQUAL(s, "a ; a");
+ LMI_TEST_EQUAL(s, "a ; a");
ltrim(s, superfluous); rtrim(s, superfluous); // Does nothing, correctly.
- BOOST_TEST_EQUAL(s, "a ; a");
+ LMI_TEST_EQUAL(s, "a ; a");
}
int test_main(int, char*[])
diff --git a/monnaie_test.cpp b/monnaie_test.cpp
index abb6ff1..de86a11 100644
--- a/monnaie_test.cpp
+++ b/monnaie_test.cpp
@@ -75,88 +75,88 @@ void monnaie_test::test()
void monnaie_test::test_ctors()
{
- BOOST_TEST_EQUAL(monnaie( ).total_cents(), 0);
- BOOST_TEST_EQUAL(monnaie(0, 99).total_cents(), 99);
- BOOST_TEST_EQUAL(monnaie(1, 99).total_cents(), 199);
+ LMI_TEST_EQUAL(monnaie( ).total_cents(), 0);
+ LMI_TEST_EQUAL(monnaie(0, 99).total_cents(), 99);
+ LMI_TEST_EQUAL(monnaie(1, 99).total_cents(), 199);
monnaie const c(4, 56);
- BOOST_TEST_EQUAL(monnaie(c).total_cents(), 456);
+ LMI_TEST_EQUAL(monnaie(c).total_cents(), 456);
static char const* const overflow_msg = "Currency amount out of range.";
- BOOST_TEST_THROW(monnaie(-1, 0), std::overflow_error, overflow_msg);
- BOOST_TEST_THROW(monnaie(-1, 99), std::overflow_error, overflow_msg);
- BOOST_TEST_THROW(monnaie(-1, -99), std::overflow_error, overflow_msg);
- BOOST_TEST_THROW
+ LMI_TEST_THROW(monnaie(-1, 0), std::overflow_error, overflow_msg);
+ LMI_TEST_THROW(monnaie(-1, 99), std::overflow_error, overflow_msg);
+ LMI_TEST_THROW(monnaie(-1, -99), std::overflow_error, overflow_msg);
+ LMI_TEST_THROW
(monnaie(std::numeric_limits<monnaie::amount_type>::max(), 0)
,std::overflow_error
,overflow_msg
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(monnaie(std::numeric_limits<monnaie::amount_type>::min(), 0)
,std::overflow_error
,overflow_msg
);
static char const* const cents_msg = "Invalid number of cents.";
- BOOST_TEST_THROW(monnaie(1, 100), std::runtime_error, cents_msg);
- BOOST_TEST_THROW(monnaie(1, 101), std::runtime_error, cents_msg);
- BOOST_TEST_THROW(monnaie(1, -1), std::runtime_error, cents_msg);
+ LMI_TEST_THROW(monnaie(1, 100), std::runtime_error, cents_msg);
+ LMI_TEST_THROW(monnaie(1, 101), std::runtime_error, cents_msg);
+ LMI_TEST_THROW(monnaie(1, -1), std::runtime_error, cents_msg);
}
void monnaie_test::test_accessors()
{
auto c = monnaie(1234, 56);
- BOOST_TEST_EQUAL(c.dollars(), 1234);
- BOOST_TEST_EQUAL(c.cents() , 56);
+ LMI_TEST_EQUAL(c.dollars(), 1234);
+ LMI_TEST_EQUAL(c.cents() , 56);
c = -monnaie(9876543, 21);
- BOOST_TEST_EQUAL(c.dollars(), -9876543);
- BOOST_TEST_EQUAL(c.cents() , -21);
+ LMI_TEST_EQUAL(c.dollars(), -9876543);
+ LMI_TEST_EQUAL(c.cents() , -21);
c = -monnaie(0, 99);
- BOOST_TEST_EQUAL(c.dollars(), 0);
- BOOST_TEST_EQUAL(c.cents() , -99);
+ LMI_TEST_EQUAL(c.dollars(), 0);
+ LMI_TEST_EQUAL(c.cents() , -99);
c = -c;
- BOOST_TEST_EQUAL(c.dollars(), 0);
- BOOST_TEST_EQUAL(c.cents() , 99);
+ LMI_TEST_EQUAL(c.dollars(), 0);
+ LMI_TEST_EQUAL(c.cents() , 99);
}
void monnaie_test::test_comparison()
{
- BOOST_TEST( monnaie(1, 23) < monnaie(1, 24));
- BOOST_TEST(-monnaie(1, 23) > -monnaie(1, 24));
+ LMI_TEST( monnaie(1, 23) < monnaie(1, 24));
+ LMI_TEST(-monnaie(1, 23) > -monnaie(1, 24));
- BOOST_TEST( monnaie(1, 23) <= monnaie(1, 23));
- BOOST_TEST( monnaie(1, 23) == monnaie(1, 23));
- BOOST_TEST( monnaie(1, 23) != monnaie(1, 24));
- BOOST_TEST( monnaie(1, 23) >= monnaie(1, 23));
+ LMI_TEST( monnaie(1, 23) <= monnaie(1, 23));
+ LMI_TEST( monnaie(1, 23) == monnaie(1, 23));
+ LMI_TEST( monnaie(1, 23) != monnaie(1, 24));
+ LMI_TEST( monnaie(1, 23) >= monnaie(1, 23));
}
void monnaie_test::test_arithmetic()
{
auto c = monnaie(1, 23) + monnaie(4, 77);
- BOOST_TEST_EQUAL(c.total_cents(), 600);
+ LMI_TEST_EQUAL(c.total_cents(), 600);
c *= 12;
- BOOST_TEST_EQUAL(c.total_cents(), 7200);
+ LMI_TEST_EQUAL(c.total_cents(), 7200);
// $72.00 - $80.10 = $8.10
auto d = c - monnaie(80, 10);
- BOOST_TEST_EQUAL(d.total_cents(), -810);
+ LMI_TEST_EQUAL(d.total_cents(), -810);
}
void monnaie_test::test_double()
{
- BOOST_TEST_EQUAL(monnaie::from_value( 1.23).total_cents(), 123);
- BOOST_TEST_EQUAL(monnaie::from_value(-1.23).total_cents(), -123);
+ LMI_TEST_EQUAL(monnaie::from_value( 1.23).total_cents(), 123);
+ LMI_TEST_EQUAL(monnaie::from_value(-1.23).total_cents(), -123);
- BOOST_TEST_EQUAL(monnaie::from_value( 0.005).total_cents(), 1);
- BOOST_TEST_EQUAL(monnaie::from_value(-0.005).total_cents(), -1);
+ LMI_TEST_EQUAL(monnaie::from_value( 0.005).total_cents(), 1);
+ LMI_TEST_EQUAL(monnaie::from_value(-0.005).total_cents(), -1);
auto c = monnaie::from_value( 14857345.859999999404);
- BOOST_TEST_EQUAL(c.total_cents() , 1485734586);
- BOOST_TEST(materially_equal(c.value(), 14857345.86));
+ LMI_TEST_EQUAL(c.total_cents() , 1485734586);
+ LMI_TEST(materially_equal(c.value(), 14857345.86));
}
void test_stream_roundtrip
@@ -170,12 +170,12 @@ void test_stream_roundtrip
monnaie c;
ss << c0;
- INVOKE_BOOST_TEST_EQUAL(ss.str(), str, file, line);
+ INVOKE_LMI_TEST_EQUAL(ss.str(), str, file, line);
ss >> c;
- INVOKE_BOOST_TEST( ss.eof (), file, line);
- INVOKE_BOOST_TEST(!ss.fail(), file, line);
- INVOKE_BOOST_TEST(!ss.bad (), file, line);
- INVOKE_BOOST_TEST_EQUAL(c, c0, file, line);
+ INVOKE_LMI_TEST( ss.eof (), file, line);
+ INVOKE_LMI_TEST(!ss.fail(), file, line);
+ INVOKE_LMI_TEST(!ss.bad (), file, line);
+ INVOKE_LMI_TEST_EQUAL(c, c0, file, line);
}
void monnaie_test::test_streams()
diff --git a/mortality_rates_test.cpp b/mortality_rates_test.cpp
index f3191e3..782d538 100644
--- a/mortality_rates_test.cpp
+++ b/mortality_rates_test.cpp
@@ -143,15 +143,15 @@ class mortality_rates_test
void mortality_rates_test::test_4095_4096ths()
{
static double const q = static_cast<double>(1.0L - 1.0L / 4096.0L);
- BOOST_TEST_EQUAL(0.999755859375, q);
- BOOST_TEST_EQUAL(1.0, coi_rate_from_q<double>()(q, 1.0));
+ LMI_TEST_EQUAL(0.999755859375, q);
+ LMI_TEST_EQUAL(1.0, coi_rate_from_q<double>()(q, 1.0));
}
void mortality_rates_test::test_annual_to_monthly_conversion()
{
for(int j = 0; j < lmi::ssize(annual_rates()); ++j)
{
- BOOST_TEST
+ LMI_TEST
(materially_equal
( monthly_rates()[j]
,coi_rate_from_q<double>()(annual_rates ()[j], 1.0)
@@ -203,10 +203,10 @@ void mortality_rates_test::test_guaranteed_rates
y = coi_rate_from_q<double>()(y, z.MaxMonthlyCoiRate_);
y = rounder(y);
- BOOST_TEST(materially_equal(y, v0[j]));
- BOOST_TEST(materially_equal(x, v1[j]));
+ LMI_TEST(materially_equal(y, v0[j]));
+ LMI_TEST(materially_equal(x, v1[j]));
// This needn't necessarily hold:
-// BOOST_TEST(materially_equal(x, y));
+// LMI_TEST(materially_equal(x, y));
// To compare values:
// std::cout << j << '\t' << x << '\t' << y << std::endl;
}
diff --git a/name_value_pairs_test.cpp b/name_value_pairs_test.cpp
index 0facade..59fe4b2 100644
--- a/name_value_pairs_test.cpp
+++ b/name_value_pairs_test.cpp
@@ -44,7 +44,7 @@ int test_main(int, char*[])
{
std::ofstream os(filename0.c_str(), ios_out_trunc_binary());
- BOOST_TEST(os.good());
+ LMI_TEST(os.good());
os
<< "a=a\n"
@@ -69,42 +69,42 @@ int test_main(int, char*[])
name_value_pairs nv_pairs_0(filename0);
std::map<std::string, std::string> m0 = nv_pairs_0.map();
- BOOST_TEST(0 == std::remove(filename0.c_str()));
+ LMI_TEST(0 == std::remove(filename0.c_str()));
- BOOST_TEST_EQUAL(15, m0.size());
+ LMI_TEST_EQUAL(15, m0.size());
// Test string_value().
- BOOST_TEST_EQUAL("a" , nv_pairs_0.string_value("a"));
- BOOST_TEST_EQUAL("b" , nv_pairs_0.string_value("b"));
- BOOST_TEST_EQUAL("" , nv_pairs_0.string_value("c"));
- BOOST_TEST_EQUAL("=" , nv_pairs_0.string_value("d"));
- BOOST_TEST_EQUAL("1=." , nv_pairs_0.string_value("e"));
+ LMI_TEST_EQUAL("a" , nv_pairs_0.string_value("a"));
+ LMI_TEST_EQUAL("b" , nv_pairs_0.string_value("b"));
+ LMI_TEST_EQUAL("" , nv_pairs_0.string_value("c"));
+ LMI_TEST_EQUAL("=" , nv_pairs_0.string_value("d"));
+ LMI_TEST_EQUAL("1=." , nv_pairs_0.string_value("e"));
#if !defined LMI_MSW
- BOOST_TEST_EQUAL(" f \r" , nv_pairs_0.string_value("f"));
+ LMI_TEST_EQUAL(" f \r" , nv_pairs_0.string_value("f"));
#else // defined LMI_MSW
- BOOST_TEST_EQUAL(" f " , nv_pairs_0.string_value("f"));
+ LMI_TEST_EQUAL(" f " , nv_pairs_0.string_value("f"));
#endif // defined LMI_MSW
- BOOST_TEST_EQUAL("a test", nv_pairs_0.string_value("this"));
+ LMI_TEST_EQUAL("a test", nv_pairs_0.string_value("this"));
// Test numeric_value().
- BOOST_TEST_EQUAL( 2.0 , nv_pairs_0.numeric_value("z"));
- BOOST_TEST_EQUAL(-3.142 , nv_pairs_0.numeric_value("y"));
- BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("x"));
- BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("w"));
- BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("v"));
- BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("u"));
- BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("t"));
- BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("s"));
+ LMI_TEST_EQUAL( 2.0 , nv_pairs_0.numeric_value("z"));
+ LMI_TEST_EQUAL(-3.142 , nv_pairs_0.numeric_value("y"));
+ LMI_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("x"));
+ LMI_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("w"));
+ LMI_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("v"));
+ LMI_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("u"));
+ LMI_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("t"));
+ LMI_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("s"));
- BOOST_TEST_EQUAL("2.718" , nv_pairs_0.string_numeric_value("v"));
- BOOST_TEST_EQUAL("0" , nv_pairs_0.string_numeric_value("s"));
+ LMI_TEST_EQUAL("2.718" , nv_pairs_0.string_numeric_value("v"));
+ LMI_TEST_EQUAL("0" , nv_pairs_0.string_numeric_value("s"));
std::string filename1(tmp + "/nonexistent_name_value_pairs_test_file");
name_value_pairs nv_pairs_1(filename1);
std::map<std::string, std::string> m1 = nv_pairs_1.map();
- BOOST_TEST_EQUAL(0, m1.size());
+ LMI_TEST_EQUAL(0, m1.size());
fs::remove(tmpdir);
diff --git a/ncnnnpnn_test.cpp b/ncnnnpnn_test.cpp
index 94647f9..ed5b566 100644
--- a/ncnnnpnn_test.cpp
+++ b/ncnnnpnn_test.cpp
@@ -33,88 +33,88 @@
int test_main(int, char*[])
{
- BOOST_TEST_EQUAL( "1,234,567,890.14", ncnnnpnn( 1234567890.14159));
- BOOST_TEST_EQUAL( "234,567,890.14", ncnnnpnn( 234567890.14159));
- BOOST_TEST_EQUAL( "34,567,890.14", ncnnnpnn( 34567890.14159));
- BOOST_TEST_EQUAL( "4,567,890.14", ncnnnpnn( 4567890.14159));
- BOOST_TEST_EQUAL( "567,890.14", ncnnnpnn( 567890.14159));
- BOOST_TEST_EQUAL( "67,890.14", ncnnnpnn( 67890.14159));
- BOOST_TEST_EQUAL( "7,890.14", ncnnnpnn( 7890.14159));
- BOOST_TEST_EQUAL( "890.14", ncnnnpnn( 890.14159));
- BOOST_TEST_EQUAL( "90.14", ncnnnpnn( 90.14159));
- BOOST_TEST_EQUAL( "0.14", ncnnnpnn( 0.14159));
- BOOST_TEST_EQUAL( "1,234,567,890.00", ncnnnpnn( 1234567890.0 ));
- BOOST_TEST_EQUAL( "234,567,890.00", ncnnnpnn( 234567890.0 ));
- BOOST_TEST_EQUAL( "34,567,890.00", ncnnnpnn( 34567890.0 ));
- BOOST_TEST_EQUAL( "4,567,890.00", ncnnnpnn( 4567890.0 ));
- BOOST_TEST_EQUAL( "567,890.00", ncnnnpnn( 567890.0 ));
- BOOST_TEST_EQUAL( "67,890.00", ncnnnpnn( 67890.0 ));
- BOOST_TEST_EQUAL( "7,890.00", ncnnnpnn( 7890.0 ));
- BOOST_TEST_EQUAL( "890.00", ncnnnpnn( 890.0 ));
- BOOST_TEST_EQUAL( "90.00", ncnnnpnn( 90.0 ));
- BOOST_TEST_EQUAL( "1.00", ncnnnpnn( 1.0 ));
- BOOST_TEST_EQUAL( "1,000,000,000.00", ncnnnpnn( 1000000000.0 ));
- BOOST_TEST_EQUAL( "100,000,000.00", ncnnnpnn( 100000000.0 ));
- BOOST_TEST_EQUAL( "10,000,000.00", ncnnnpnn( 10000000.0 ));
- BOOST_TEST_EQUAL( "1,000,000.00", ncnnnpnn( 1000000.0 ));
- BOOST_TEST_EQUAL( "100,000.00", ncnnnpnn( 100000.0 ));
- BOOST_TEST_EQUAL( "10,000.00", ncnnnpnn( 10000.0 ));
- BOOST_TEST_EQUAL( "1,000.00", ncnnnpnn( 1000.0 ));
- BOOST_TEST_EQUAL( "100.00", ncnnnpnn( 100.0 ));
- BOOST_TEST_EQUAL( "10.00", ncnnnpnn( 10.0 ));
- BOOST_TEST_EQUAL( "1.00", ncnnnpnn( 1.0 ));
- BOOST_TEST_EQUAL( "0.10", ncnnnpnn( 0.1 ));
- BOOST_TEST_EQUAL( "0.01", ncnnnpnn( 0.01 ));
- BOOST_TEST_EQUAL( "2,147,483,647.00", ncnnnpnn( 2147483647.0 ));
- BOOST_TEST_EQUAL( "2,000.00", ncnnnpnn( 1999.999 ));
- BOOST_TEST_EQUAL( "2,000.00", ncnnnpnn( 1999.99501));
- BOOST_TEST_EQUAL( "1,999.99", ncnnnpnn( 1999.99499));
- BOOST_TEST_EQUAL( "1,900.00", ncnnnpnn( 1899.999 ));
- BOOST_TEST_EQUAL( "10,000,000.00", ncnnnpnn( 9999999.999 ));
+ LMI_TEST_EQUAL( "1,234,567,890.14", ncnnnpnn( 1234567890.14159));
+ LMI_TEST_EQUAL( "234,567,890.14", ncnnnpnn( 234567890.14159));
+ LMI_TEST_EQUAL( "34,567,890.14", ncnnnpnn( 34567890.14159));
+ LMI_TEST_EQUAL( "4,567,890.14", ncnnnpnn( 4567890.14159));
+ LMI_TEST_EQUAL( "567,890.14", ncnnnpnn( 567890.14159));
+ LMI_TEST_EQUAL( "67,890.14", ncnnnpnn( 67890.14159));
+ LMI_TEST_EQUAL( "7,890.14", ncnnnpnn( 7890.14159));
+ LMI_TEST_EQUAL( "890.14", ncnnnpnn( 890.14159));
+ LMI_TEST_EQUAL( "90.14", ncnnnpnn( 90.14159));
+ LMI_TEST_EQUAL( "0.14", ncnnnpnn( 0.14159));
+ LMI_TEST_EQUAL( "1,234,567,890.00", ncnnnpnn( 1234567890.0 ));
+ LMI_TEST_EQUAL( "234,567,890.00", ncnnnpnn( 234567890.0 ));
+ LMI_TEST_EQUAL( "34,567,890.00", ncnnnpnn( 34567890.0 ));
+ LMI_TEST_EQUAL( "4,567,890.00", ncnnnpnn( 4567890.0 ));
+ LMI_TEST_EQUAL( "567,890.00", ncnnnpnn( 567890.0 ));
+ LMI_TEST_EQUAL( "67,890.00", ncnnnpnn( 67890.0 ));
+ LMI_TEST_EQUAL( "7,890.00", ncnnnpnn( 7890.0 ));
+ LMI_TEST_EQUAL( "890.00", ncnnnpnn( 890.0 ));
+ LMI_TEST_EQUAL( "90.00", ncnnnpnn( 90.0 ));
+ LMI_TEST_EQUAL( "1.00", ncnnnpnn( 1.0 ));
+ LMI_TEST_EQUAL( "1,000,000,000.00", ncnnnpnn( 1000000000.0 ));
+ LMI_TEST_EQUAL( "100,000,000.00", ncnnnpnn( 100000000.0 ));
+ LMI_TEST_EQUAL( "10,000,000.00", ncnnnpnn( 10000000.0 ));
+ LMI_TEST_EQUAL( "1,000,000.00", ncnnnpnn( 1000000.0 ));
+ LMI_TEST_EQUAL( "100,000.00", ncnnnpnn( 100000.0 ));
+ LMI_TEST_EQUAL( "10,000.00", ncnnnpnn( 10000.0 ));
+ LMI_TEST_EQUAL( "1,000.00", ncnnnpnn( 1000.0 ));
+ LMI_TEST_EQUAL( "100.00", ncnnnpnn( 100.0 ));
+ LMI_TEST_EQUAL( "10.00", ncnnnpnn( 10.0 ));
+ LMI_TEST_EQUAL( "1.00", ncnnnpnn( 1.0 ));
+ LMI_TEST_EQUAL( "0.10", ncnnnpnn( 0.1 ));
+ LMI_TEST_EQUAL( "0.01", ncnnnpnn( 0.01 ));
+ LMI_TEST_EQUAL( "2,147,483,647.00", ncnnnpnn( 2147483647.0 ));
+ LMI_TEST_EQUAL( "2,000.00", ncnnnpnn( 1999.999 ));
+ LMI_TEST_EQUAL( "2,000.00", ncnnnpnn( 1999.99501));
+ LMI_TEST_EQUAL( "1,999.99", ncnnnpnn( 1999.99499));
+ LMI_TEST_EQUAL( "1,900.00", ncnnnpnn( 1899.999 ));
+ LMI_TEST_EQUAL( "10,000,000.00", ncnnnpnn( 9999999.999 ));
// Repeat with negatives.
- BOOST_TEST_EQUAL("-1,234,567,890.14", ncnnnpnn(-1234567890.14159));
- BOOST_TEST_EQUAL( "-234,567,890.14", ncnnnpnn( -234567890.14159));
- BOOST_TEST_EQUAL( "-34,567,890.14", ncnnnpnn( -34567890.14159));
- BOOST_TEST_EQUAL( "-4,567,890.14", ncnnnpnn( -4567890.14159));
- BOOST_TEST_EQUAL( "-567,890.14", ncnnnpnn( -567890.14159));
- BOOST_TEST_EQUAL( "-67,890.14", ncnnnpnn( -67890.14159));
- BOOST_TEST_EQUAL( "-7,890.14", ncnnnpnn( -7890.14159));
- BOOST_TEST_EQUAL( "-890.14", ncnnnpnn( -890.14159));
- BOOST_TEST_EQUAL( "-90.14", ncnnnpnn( -90.14159));
- BOOST_TEST_EQUAL( "-0.14", ncnnnpnn( -0.14159));
- BOOST_TEST_EQUAL("-1,234,567,890.00", ncnnnpnn(-1234567890.0 ));
- BOOST_TEST_EQUAL( "-234,567,890.00", ncnnnpnn( -234567890.0 ));
- BOOST_TEST_EQUAL( "-34,567,890.00", ncnnnpnn( -34567890.0 ));
- BOOST_TEST_EQUAL( "-4,567,890.00", ncnnnpnn( -4567890.0 ));
- BOOST_TEST_EQUAL( "-567,890.00", ncnnnpnn( -567890.0 ));
- BOOST_TEST_EQUAL( "-67,890.00", ncnnnpnn( -67890.0 ));
- BOOST_TEST_EQUAL( "-7,890.00", ncnnnpnn( -7890.0 ));
- BOOST_TEST_EQUAL( "-890.00", ncnnnpnn( -890.0 ));
- BOOST_TEST_EQUAL( "-90.00", ncnnnpnn( -90.0 ));
- BOOST_TEST_EQUAL( "-1.00", ncnnnpnn( -1.0 ));
- BOOST_TEST_EQUAL("-1,000,000,000.00", ncnnnpnn(-1000000000.0 ));
- BOOST_TEST_EQUAL( "-100,000,000.00", ncnnnpnn( -100000000.0 ));
- BOOST_TEST_EQUAL( "-10,000,000.00", ncnnnpnn( -10000000.0 ));
- BOOST_TEST_EQUAL( "-1,000,000.00", ncnnnpnn( -1000000.0 ));
- BOOST_TEST_EQUAL( "-100,000.00", ncnnnpnn( -100000.0 ));
- BOOST_TEST_EQUAL( "-10,000.00", ncnnnpnn( -10000.0 ));
- BOOST_TEST_EQUAL( "-1,000.00", ncnnnpnn( -1000.0 ));
- BOOST_TEST_EQUAL( "-100.00", ncnnnpnn( -100.0 ));
- BOOST_TEST_EQUAL( "-10.00", ncnnnpnn( -10.0 ));
- BOOST_TEST_EQUAL( "-1.00", ncnnnpnn( -1.0 ));
- BOOST_TEST_EQUAL( "-0.10", ncnnnpnn( -0.1 ));
- BOOST_TEST_EQUAL( "-0.01", ncnnnpnn( -0.01 ));
- BOOST_TEST_EQUAL("-2,147,483,647.00", ncnnnpnn(-2147483647.0 ));
- BOOST_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.999 ));
- BOOST_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.999 ));
- BOOST_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.99501));
- BOOST_TEST_EQUAL( "-1,999.99", ncnnnpnn( -1999.99499));
- BOOST_TEST_EQUAL( "-1,900.00", ncnnnpnn( -1899.999 ));
- BOOST_TEST_EQUAL( "-10,000,000.00", ncnnnpnn( -9999999.999 ));
+ LMI_TEST_EQUAL("-1,234,567,890.14", ncnnnpnn(-1234567890.14159));
+ LMI_TEST_EQUAL( "-234,567,890.14", ncnnnpnn( -234567890.14159));
+ LMI_TEST_EQUAL( "-34,567,890.14", ncnnnpnn( -34567890.14159));
+ LMI_TEST_EQUAL( "-4,567,890.14", ncnnnpnn( -4567890.14159));
+ LMI_TEST_EQUAL( "-567,890.14", ncnnnpnn( -567890.14159));
+ LMI_TEST_EQUAL( "-67,890.14", ncnnnpnn( -67890.14159));
+ LMI_TEST_EQUAL( "-7,890.14", ncnnnpnn( -7890.14159));
+ LMI_TEST_EQUAL( "-890.14", ncnnnpnn( -890.14159));
+ LMI_TEST_EQUAL( "-90.14", ncnnnpnn( -90.14159));
+ LMI_TEST_EQUAL( "-0.14", ncnnnpnn( -0.14159));
+ LMI_TEST_EQUAL("-1,234,567,890.00", ncnnnpnn(-1234567890.0 ));
+ LMI_TEST_EQUAL( "-234,567,890.00", ncnnnpnn( -234567890.0 ));
+ LMI_TEST_EQUAL( "-34,567,890.00", ncnnnpnn( -34567890.0 ));
+ LMI_TEST_EQUAL( "-4,567,890.00", ncnnnpnn( -4567890.0 ));
+ LMI_TEST_EQUAL( "-567,890.00", ncnnnpnn( -567890.0 ));
+ LMI_TEST_EQUAL( "-67,890.00", ncnnnpnn( -67890.0 ));
+ LMI_TEST_EQUAL( "-7,890.00", ncnnnpnn( -7890.0 ));
+ LMI_TEST_EQUAL( "-890.00", ncnnnpnn( -890.0 ));
+ LMI_TEST_EQUAL( "-90.00", ncnnnpnn( -90.0 ));
+ LMI_TEST_EQUAL( "-1.00", ncnnnpnn( -1.0 ));
+ LMI_TEST_EQUAL("-1,000,000,000.00", ncnnnpnn(-1000000000.0 ));
+ LMI_TEST_EQUAL( "-100,000,000.00", ncnnnpnn( -100000000.0 ));
+ LMI_TEST_EQUAL( "-10,000,000.00", ncnnnpnn( -10000000.0 ));
+ LMI_TEST_EQUAL( "-1,000,000.00", ncnnnpnn( -1000000.0 ));
+ LMI_TEST_EQUAL( "-100,000.00", ncnnnpnn( -100000.0 ));
+ LMI_TEST_EQUAL( "-10,000.00", ncnnnpnn( -10000.0 ));
+ LMI_TEST_EQUAL( "-1,000.00", ncnnnpnn( -1000.0 ));
+ LMI_TEST_EQUAL( "-100.00", ncnnnpnn( -100.0 ));
+ LMI_TEST_EQUAL( "-10.00", ncnnnpnn( -10.0 ));
+ LMI_TEST_EQUAL( "-1.00", ncnnnpnn( -1.0 ));
+ LMI_TEST_EQUAL( "-0.10", ncnnnpnn( -0.1 ));
+ LMI_TEST_EQUAL( "-0.01", ncnnnpnn( -0.01 ));
+ LMI_TEST_EQUAL("-2,147,483,647.00", ncnnnpnn(-2147483647.0 ));
+ LMI_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.999 ));
+ LMI_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.999 ));
+ LMI_TEST_EQUAL( "-2,000.00", ncnnnpnn( -1999.99501));
+ LMI_TEST_EQUAL( "-1,999.99", ncnnnpnn( -1999.99499));
+ LMI_TEST_EQUAL( "-1,900.00", ncnnnpnn( -1899.999 ));
+ LMI_TEST_EQUAL( "-10,000,000.00", ncnnnpnn( -9999999.999 ));
// Implementation-defined value [2.13.3/1].
- BOOST_TEST
+ LMI_TEST
( "1,999.99" == ncnnnpnn( 1999.995 )
|| "2,000.00" == ncnnnpnn( 1999.995 )
);
diff --git a/numeric_io_test.cpp b/numeric_io_test.cpp
index ec3493e..cc5f96c 100644
--- a/numeric_io_test.cpp
+++ b/numeric_io_test.cpp
@@ -57,28 +57,28 @@ void test_interconvertibility
bool volatile is_exact = std::numeric_limits<T>::is_exact;
if(is_exact)
{
- INVOKE_BOOST_TEST_EQUAL(v, t, file, line);
+ INVOKE_LMI_TEST_EQUAL(v, t, file, line);
}
- INVOKE_BOOST_TEST_EQUAL(v, numeric_io_cast<T>(s), file, line);
+ INVOKE_LMI_TEST_EQUAL(v, numeric_io_cast<T>(s), file, line);
T t0 = t;
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t0 ), file,
line);
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t0, s), file,
line);
- INVOKE_BOOST_TEST_EQUAL(v, numeric_io_cast (s, t0), file,
line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t0 ), file, line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t0, s), file, line);
+ INVOKE_LMI_TEST_EQUAL(v, numeric_io_cast (s, t0), file, line);
T const t1 = t;
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t1 ), file,
line);
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t1, s), file,
line);
- INVOKE_BOOST_TEST_EQUAL(v, numeric_io_cast (s, t1), file,
line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t1 ), file, line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t1, s), file, line);
+ INVOKE_LMI_TEST_EQUAL(v, numeric_io_cast (s, t1), file, line);
T const& t2 = t;
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t2 ), file,
line);
- INVOKE_BOOST_TEST_EQUAL(s, numeric_io_cast<std::string>(t2, s), file,
line);
- INVOKE_BOOST_TEST_EQUAL(v, numeric_io_cast (s, t2), file,
line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t2 ), file, line);
+ INVOKE_LMI_TEST_EQUAL(s, numeric_io_cast<std::string>(t2, s), file, line);
+ INVOKE_LMI_TEST_EQUAL(v, numeric_io_cast (s, t2), file, line);
std::string const s0 = s;
- INVOKE_BOOST_TEST_EQUAL(v, numeric_io_cast(s0, t), file, line);
+ INVOKE_LMI_TEST_EQUAL(v, numeric_io_cast(s0, t), file, line);
}
void mete_two_thirds()
@@ -111,24 +111,24 @@ static_assert(std::numeric_limits<double>::is_iec559);
int test_main(int, char*[])
{
int volatile z = 0; // Avoid "condition always true/false" warnings.
- BOOST_TEST_EQUAL( z, floating_point_decimals( 0.0));
- BOOST_TEST_EQUAL( z, floating_point_decimals(-0.0));
- BOOST_TEST_EQUAL(15, floating_point_decimals( 1.0));
- BOOST_TEST_EQUAL(15, floating_point_decimals(-1.0));
- BOOST_TEST_EQUAL(12, floating_point_decimals( 1000.0));
- BOOST_TEST_EQUAL(12, floating_point_decimals(-1000.0));
- BOOST_TEST_EQUAL( 0, floating_point_decimals( 1000000000000000.0));
- BOOST_TEST_EQUAL( 0, floating_point_decimals(-1000000000000000.0));
- BOOST_TEST_EQUAL( 0, floating_point_decimals( 10000000000000000000.0));
- BOOST_TEST_EQUAL( 0, floating_point_decimals(-10000000000000000000.0));
- BOOST_TEST_EQUAL(35, floating_point_decimals( 0.00000000000000000001));
- BOOST_TEST_EQUAL(35, floating_point_decimals(-0.00000000000000000001));
-
- BOOST_TEST_EQUAL( 3, floating_point_decimals(-1000.0f));
- BOOST_TEST_EQUAL(15, floating_point_decimals(-1000.0L));
+ LMI_TEST_EQUAL( z, floating_point_decimals( 0.0));
+ LMI_TEST_EQUAL( z, floating_point_decimals(-0.0));
+ LMI_TEST_EQUAL(15, floating_point_decimals( 1.0));
+ LMI_TEST_EQUAL(15, floating_point_decimals(-1.0));
+ LMI_TEST_EQUAL(12, floating_point_decimals( 1000.0));
+ LMI_TEST_EQUAL(12, floating_point_decimals(-1000.0));
+ LMI_TEST_EQUAL( 0, floating_point_decimals( 1000000000000000.0));
+ LMI_TEST_EQUAL( 0, floating_point_decimals(-1000000000000000.0));
+ LMI_TEST_EQUAL( 0, floating_point_decimals( 10000000000000000000.0));
+ LMI_TEST_EQUAL( 0, floating_point_decimals(-10000000000000000000.0));
+ LMI_TEST_EQUAL(35, floating_point_decimals( 0.00000000000000000001));
+ LMI_TEST_EQUAL(35, floating_point_decimals(-0.00000000000000000001));
+
+ LMI_TEST_EQUAL( 3, floating_point_decimals(-1000.0f));
+ LMI_TEST_EQUAL(15, floating_point_decimals(-1000.0L));
#if !defined LMI_MSVCRT
- BOOST_TEST_EQUAL( 0, floating_point_decimals(infinity<double>()));
+ LMI_TEST_EQUAL( 0, floating_point_decimals(infinity<double>()));
#endif // !defined LMI_MSVCRT
// Consider the number of exact decimal digits in the neighborhood
@@ -144,9 +144,9 @@ int test_main(int, char*[])
// fewer exact (fractional) digit.
// 000000000111111111
// 123456789012345678
- BOOST_TEST_EQUAL(16, floating_point_decimals(0.450359962737049596));
- BOOST_TEST_EQUAL(16, floating_point_decimals(0.4503599627370495));
- BOOST_TEST_EQUAL(16, floating_point_decimals(0.4503599627370496));
+ LMI_TEST_EQUAL(16, floating_point_decimals(0.450359962737049596));
+ LMI_TEST_EQUAL(16, floating_point_decimals(0.4503599627370495));
+ LMI_TEST_EQUAL(16, floating_point_decimals(0.4503599627370496));
// The following test failed for como with mingw (although with a
// value of 0.45036 it unsurprisingly succeeded). It was observed
// to fail also with x86_64-linux-gnu, but only because of a
@@ -158,22 +158,22 @@ int test_main(int, char*[])
// bit precision of x87 FPU.
if(!RUNNING_ON_VALGRIND)
{
- BOOST_TEST_EQUAL(15, floating_point_decimals(0.4503599627370497));
+ LMI_TEST_EQUAL(15, floating_point_decimals(0.4503599627370497));
}
- BOOST_TEST_EQUAL( "3.14", simplify_floating_point( "3.14"));
- BOOST_TEST_EQUAL( "3.14", simplify_floating_point( "3.14000"));
- BOOST_TEST_EQUAL( "100", simplify_floating_point( "100."));
- BOOST_TEST_EQUAL( "100", simplify_floating_point( "100.000"));
- BOOST_TEST_EQUAL( "0.0001", simplify_floating_point( "0.0001"));
- BOOST_TEST_EQUAL( "0.0001", simplify_floating_point( "0.00010"));
- BOOST_TEST_EQUAL( "0", simplify_floating_point( "0.0"));
- BOOST_TEST_EQUAL( "0", simplify_floating_point( "0."));
- BOOST_TEST_EQUAL( "-0", simplify_floating_point( "-0.0"));
- BOOST_TEST_EQUAL( "-0", simplify_floating_point( "-0."));
- BOOST_TEST_EQUAL( "nan", simplify_floating_point( "nan"));
- BOOST_TEST_EQUAL( "inf", simplify_floating_point( "inf"));
- BOOST_TEST_EQUAL( "-inf", simplify_floating_point( "-inf"));
+ LMI_TEST_EQUAL( "3.14", simplify_floating_point( "3.14"));
+ LMI_TEST_EQUAL( "3.14", simplify_floating_point( "3.14000"));
+ LMI_TEST_EQUAL( "100", simplify_floating_point( "100."));
+ LMI_TEST_EQUAL( "100", simplify_floating_point( "100.000"));
+ LMI_TEST_EQUAL( "0.0001", simplify_floating_point( "0.0001"));
+ LMI_TEST_EQUAL( "0.0001", simplify_floating_point( "0.00010"));
+ LMI_TEST_EQUAL( "0", simplify_floating_point( "0.0"));
+ LMI_TEST_EQUAL( "0", simplify_floating_point( "0."));
+ LMI_TEST_EQUAL( "-0", simplify_floating_point( "-0.0"));
+ LMI_TEST_EQUAL( "-0", simplify_floating_point( "-0."));
+ LMI_TEST_EQUAL( "nan", simplify_floating_point( "nan"));
+ LMI_TEST_EQUAL( "inf", simplify_floating_point( "inf"));
+ LMI_TEST_EQUAL( "-inf", simplify_floating_point( "-inf"));
// Also test strings that violate preconditions, just to make sure
// they don't cause abrupt termination.
@@ -195,37 +195,37 @@ int test_main(int, char*[])
double const volatile inf_dbl = std::numeric_limits<double>::infinity();
std::string const inf_str = numeric_io_cast<std::string>(inf_dbl);
- BOOST_TEST_EQUAL(inf_dbl, numeric_io_cast<double>(inf_str));
+ LMI_TEST_EQUAL(inf_dbl, numeric_io_cast<double>(inf_str));
// These conversions fail for borland (FWIW), which prints
// infinity as "+INF".
try
{
- BOOST_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "inf"));
- BOOST_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "INF"));
- BOOST_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "infinity"));
- BOOST_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "INFINITY"));
- BOOST_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-inf"));
- BOOST_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-INF"));
- BOOST_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-infinity"));
- BOOST_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-INFINITY"));
+ LMI_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "inf"));
+ LMI_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "INF"));
+ LMI_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "infinity"));
+ LMI_TEST_EQUAL( inf_dbl, numeric_io_cast<double>( "INFINITY"));
+ LMI_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-inf"));
+ LMI_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-INF"));
+ LMI_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-infinity"));
+ LMI_TEST_EQUAL(-inf_dbl, numeric_io_cast<double>("-INFINITY"));
}
catch(...)
{
report_exception();
- BOOST_TEST(false);
+ LMI_TEST(false);
}
// Interpreted as decimal, not as octal.
- BOOST_TEST_EQUAL(77, numeric_io_cast<int>( "077"));
+ LMI_TEST_EQUAL(77, numeric_io_cast<int>( "077"));
// Interpreted as valid decimal, not as invalid octal.
- BOOST_TEST_EQUAL(99, numeric_io_cast<int>("0099"));
+ LMI_TEST_EQUAL(99, numeric_io_cast<int>("0099"));
- BOOST_TEST_EQUAL( "Z" , numeric_io_cast<std::string>( "Z" ));
- BOOST_TEST_EQUAL(" Z" , numeric_io_cast<std::string>(" Z" ));
- BOOST_TEST_EQUAL( "Z ", numeric_io_cast<std::string>( "Z "));
- BOOST_TEST_EQUAL(" Z ", numeric_io_cast<std::string>(" Z "));
+ LMI_TEST_EQUAL( "Z" , numeric_io_cast<std::string>( "Z" ));
+ LMI_TEST_EQUAL(" Z" , numeric_io_cast<std::string>(" Z" ));
+ LMI_TEST_EQUAL( "Z ", numeric_io_cast<std::string>( "Z "));
+ LMI_TEST_EQUAL(" Z ", numeric_io_cast<std::string>(" Z "));
#if defined __GNUC__
# pragma GCC diagnostic push
@@ -251,14 +251,14 @@ int test_main(int, char*[])
// correspond to the string literal "32", but never to a blank
// string.
//
- BOOST_TEST_UNEQUAL(" ", numeric_io_cast<std::string>(' '));
+ LMI_TEST_UNEQUAL(" ", numeric_io_cast<std::string>(' '));
//
// Furthermore, these expressions should throw because strtol
// doesn't consider "A" valid.
//
- BOOST_TEST_THROW(numeric_io_cast<char >("A"), std::invalid_argument, "");
- BOOST_TEST_THROW(numeric_io_cast<int >("A"), std::invalid_argument, "");
- BOOST_TEST_THROW(numeric_io_cast<double>("A"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<char >("A"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<int >("A"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<double>("A"), std::invalid_argument, "");
test_interconvertibility(bool(1), "1", __FILE__, __LINE__);
test_interconvertibility(bool(0), "0", __FILE__, __LINE__);
@@ -285,7 +285,7 @@ int test_main(int, char*[])
test_interconvertibility( 0.0L, "0", __FILE__, __LINE__);
test_interconvertibility( 1.5L, "1.5", __FILE__, __LINE__);
test_interconvertibility( -2.5L, "-2.5", __FILE__, __LINE__);
- BOOST_TEST_EQUAL(numeric_io_cast<long
double>("3.36210314311209350626e-4932"), std::numeric_limits<long
double>::min());
+ LMI_TEST_EQUAL(numeric_io_cast<long
double>("3.36210314311209350626e-4932"), std::numeric_limits<long
double>::min());
#endif // !defined LMI_MSVCRT
#if defined __GNUC__
@@ -297,29 +297,29 @@ int test_main(int, char*[])
// test_interconvertibility(" as df ", std::string(" as df "),...
// is not supported: it seems fraudulent.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(numeric_io_cast<double>(std::string("0.333 "))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(numeric_io_cast<double>(std::string("0.333.777#3"))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(numeric_io_cast<double>(std::string("xxx"))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW(numeric_io_cast<int> ( "1.1"), std::invalid_argument,
"");
- BOOST_TEST_THROW(numeric_io_cast<int> ( "1e1"), std::invalid_argument,
"");
- BOOST_TEST_THROW(numeric_io_cast<bool> ("true"), std::invalid_argument,
"");
- BOOST_TEST_THROW(numeric_io_cast<int> ( ""), std::invalid_argument,
"");
- BOOST_TEST_THROW(numeric_io_cast<double>( ""), std::invalid_argument,
"");
- BOOST_TEST_THROW(numeric_io_cast<double>( "1e"), std::invalid_argument,
"");
+ LMI_TEST_THROW(numeric_io_cast<int> ( "1.1"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<int> ( "1e1"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<bool> ("true"), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<int> ( ""), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<double>( ""), std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<double>( "1e"), std::invalid_argument, "");
- BOOST_TEST_THROW(numeric_io_cast<long double>(""), std::invalid_argument,
"");
+ LMI_TEST_THROW(numeric_io_cast<long double>(""), std::invalid_argument,
"");
#if defined __MINGW32__ && defined __GNUC__ && LMI_GCC_VERSION < 30404
std::cerr
@@ -329,38 +329,38 @@ int test_main(int, char*[])
;
#endif // MinGW gcc version prior to 3.4.4 .
- BOOST_TEST_THROW(numeric_io_cast<long double>( "1e"),
std::invalid_argument, "");
+ LMI_TEST_THROW(numeric_io_cast<long double>( "1e"),
std::invalid_argument, "");
// This shouldn't even throw, because adequate compilers detect
// the error at compile time:
-// BOOST_TEST_THROW(numeric_io_cast<double*>("0"), std::invalid_argument,
"");
+// LMI_TEST_THROW(numeric_io_cast<double*>("0"), std::invalid_argument, "");
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(numeric_io_cast<std::string>(static_cast<char const*>(nullptr))
,std::runtime_error
,"Cannot convert (char const*)(0) to std::string."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(numeric_io_cast<unsigned int>(static_cast<char const*>(nullptr))
,std::runtime_error
,"Cannot convert (char const*)(0) to number."
);
- BOOST_TEST_EQUAL("1", numeric_io_cast<std::string>(true));
- BOOST_TEST_EQUAL("0", numeric_io_cast<std::string>(false));
- BOOST_TEST_EQUAL( 0, numeric_io_cast<double>("0"));
- BOOST_TEST_EQUAL( "", numeric_io_cast<std::string>(""));
- BOOST_TEST_EQUAL(" ", numeric_io_cast<std::string>(" "));
-
- BOOST_TEST_EQUAL( 0, numeric_io_cast<double>("0."));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("1."));
- BOOST_TEST_EQUAL( 0, numeric_io_cast<double>(".0"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("1"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("1e0"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("1.e0"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("1.0e0"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>("0.1e1"));
- BOOST_TEST_EQUAL( 1, numeric_io_cast<double>(".1e1"));
+ LMI_TEST_EQUAL("1", numeric_io_cast<std::string>(true));
+ LMI_TEST_EQUAL("0", numeric_io_cast<std::string>(false));
+ LMI_TEST_EQUAL( 0, numeric_io_cast<double>("0"));
+ LMI_TEST_EQUAL( "", numeric_io_cast<std::string>(""));
+ LMI_TEST_EQUAL(" ", numeric_io_cast<std::string>(" "));
+
+ LMI_TEST_EQUAL( 0, numeric_io_cast<double>("0."));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("1."));
+ LMI_TEST_EQUAL( 0, numeric_io_cast<double>(".0"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("1"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("1e0"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("1.e0"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("1.0e0"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>("0.1e1"));
+ LMI_TEST_EQUAL( 1, numeric_io_cast<double>(".1e1"));
test_interconvertibility(std::exp(1.0), "2.718281828459045", __FILE__,
__LINE__);
@@ -385,15 +385,15 @@ int test_main(int, char*[])
test_interconvertibility((1.0 / 3.0), "0.3333333333333333", __FILE__,
__LINE__);
test_interconvertibility((2.0 / 3.0), "0.666666666666667" , __FILE__,
__LINE__);
- BOOST_TEST_EQUAL ("1" , numeric_io_cast<std::string>(1.0 +
2.2204460492503131e-16));
- BOOST_TEST_EQUAL ("0.5", numeric_io_cast<std::string>(0.5 +
2.2204460492503131e-16));
- BOOST_TEST_UNEQUAL("0.4", numeric_io_cast<std::string>(0.4 +
2.2204460492503131e-16));
- BOOST_TEST_UNEQUAL("0.1", numeric_io_cast<std::string>(0.1 +
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("1" , numeric_io_cast<std::string>(1.0 +
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("0.5", numeric_io_cast<std::string>(0.5 +
2.2204460492503131e-16));
+ LMI_TEST_UNEQUAL("0.4", numeric_io_cast<std::string>(0.4 +
2.2204460492503131e-16));
+ LMI_TEST_UNEQUAL("0.1", numeric_io_cast<std::string>(0.1 +
2.2204460492503131e-16));
// 1 +/- epsilon must be formatted as apparent unity.
bool volatile eq = (1.0 + 2.2204460492503131e-16 ==
1.00000000000000022204460492503131);
- BOOST_TEST(eq);
- BOOST_TEST_EQUAL("1",
numeric_io_cast<std::string>(1.00000000000000022204460492503131));
+ LMI_TEST(eq);
+ LMI_TEST_EQUAL("1",
numeric_io_cast<std::string>(1.00000000000000022204460492503131));
// Consider:
// 1111111
// 1 234567890123456
@@ -408,12 +408,12 @@ int test_main(int, char*[])
// Adding three times epsilon would change the sixteenth digit,
// however. Therefore, in the neighborhood of unity, we have a
// resolution of two ulps but not three.
- BOOST_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 + 1.0 *
2.2204460492503131e-16));
- BOOST_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 + 2.0 *
2.2204460492503131e-16));
- BOOST_TEST_UNEQUAL("1", numeric_io_cast<std::string>(1.0 + 3.0 *
2.2204460492503131e-16));
- BOOST_TEST_UNEQUAL("1", numeric_io_cast<std::string>(1.0 - 3.0 *
2.2204460492503131e-16));
- BOOST_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 - 2.0 *
2.2204460492503131e-16));
- BOOST_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 - 1.0 *
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 + 1.0 *
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 + 2.0 *
2.2204460492503131e-16));
+ LMI_TEST_UNEQUAL("1", numeric_io_cast<std::string>(1.0 + 3.0 *
2.2204460492503131e-16));
+ LMI_TEST_UNEQUAL("1", numeric_io_cast<std::string>(1.0 - 3.0 *
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 - 2.0 *
2.2204460492503131e-16));
+ LMI_TEST_EQUAL ("1", numeric_io_cast<std::string>(1.0 - 1.0 *
2.2204460492503131e-16));
return 0;
}
diff --git a/path_utility_test.cpp b/path_utility_test.cpp
index 1c96807..c224b0e 100644
--- a/path_utility_test.cpp
+++ b/path_utility_test.cpp
@@ -60,27 +60,27 @@ namespace
void test_modify_directory()
{
// Motivating case:
- BOOST_TEST_EQUAL("/usr/bin/sh" , modify_directory("/bin/sh",
"/usr/bin").string());
+ LMI_TEST_EQUAL("/usr/bin/sh" , modify_directory("/bin/sh",
"/usr/bin").string());
fs::path const file("sh");
fs::path const dir0("/bin");
fs::path const dir1("/usr/bin/");
- BOOST_TEST_EQUAL("/bin/sh" , modify_directory(file , dir0
).string());
- BOOST_TEST_EQUAL("/bin/sh" , modify_directory("sh" , "/bin/"
).string());
- BOOST_TEST_EQUAL("/usr/bin/wish", modify_directory("wish" , dir1
).string());
- BOOST_TEST_EQUAL("/usr/bin/wish", modify_directory("wish" ,
"/usr/bin").string());
+ LMI_TEST_EQUAL("/bin/sh" , modify_directory(file , dir0
).string());
+ LMI_TEST_EQUAL("/bin/sh" , modify_directory("sh" , "/bin/"
).string());
+ LMI_TEST_EQUAL("/usr/bin/wish", modify_directory("wish" , dir1
).string());
+ LMI_TEST_EQUAL("/usr/bin/wish", modify_directory("wish" ,
"/usr/bin").string());
// An empty directory may be supplied.
- BOOST_TEST_EQUAL("sh" , modify_directory("sh" , ""
).string());
- BOOST_TEST_EQUAL("sh" , modify_directory("/bin/sh", ""
).string());
+ LMI_TEST_EQUAL("sh" , modify_directory("sh" , ""
).string());
+ LMI_TEST_EQUAL("sh" , modify_directory("/bin/sh", ""
).string());
// Arguably this should be forbidden:
// $ls /bin/sh/
// ls: cannot access '/bin/sh/': Not a directory
- BOOST_TEST_EQUAL("/bin/sh" , modify_directory("sh/" , "/bin/"
).string());
+ LMI_TEST_EQUAL("/bin/sh" , modify_directory("sh/" , "/bin/"
).string());
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(modify_directory("", "/bin")
,std::runtime_error
,"Assertion 'original_filepath.has_leaf()' failed."
@@ -89,36 +89,36 @@ void test_modify_directory()
void test_orthodox_filename()
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(orthodox_filename("")
,std::runtime_error
,"Assertion '!original_filename.empty()' failed."
);
- BOOST_TEST_EQUAL("Z" , orthodox_filename("Z"));
- BOOST_TEST_EQUAL("_" , orthodox_filename("."));
- BOOST_TEST_EQUAL("_" , orthodox_filename("#"));
+ LMI_TEST_EQUAL("Z" , orthodox_filename("Z"));
+ LMI_TEST_EQUAL("_" , orthodox_filename("."));
+ LMI_TEST_EQUAL("_" , orthodox_filename("#"));
- BOOST_TEST_EQUAL("AZ" , orthodox_filename("AZ"));
- BOOST_TEST_EQUAL("A_" , orthodox_filename("A."));
- BOOST_TEST_EQUAL("_Z" , orthodox_filename(".Z"));
- BOOST_TEST_EQUAL("__" , orthodox_filename(".."));
- BOOST_TEST_EQUAL("__" , orthodox_filename("##"));
+ LMI_TEST_EQUAL("AZ" , orthodox_filename("AZ"));
+ LMI_TEST_EQUAL("A_" , orthodox_filename("A."));
+ LMI_TEST_EQUAL("_Z" , orthodox_filename(".Z"));
+ LMI_TEST_EQUAL("__" , orthodox_filename(".."));
+ LMI_TEST_EQUAL("__" , orthodox_filename("##"));
- BOOST_TEST_EQUAL("A.Z" , orthodox_filename("A.Z"));
- BOOST_TEST_EQUAL("A-Z" , orthodox_filename("A-Z"));
+ LMI_TEST_EQUAL("A.Z" , orthodox_filename("A.Z"));
+ LMI_TEST_EQUAL("A-Z" , orthodox_filename("A-Z"));
- BOOST_TEST_EQUAL("_xyz_" , orthodox_filename(".xyz."));
- BOOST_TEST_EQUAL("_xyz_" , orthodox_filename("-xyz-"));
+ LMI_TEST_EQUAL("_xyz_" , orthodox_filename(".xyz."));
+ LMI_TEST_EQUAL("_xyz_" , orthodox_filename("-xyz-"));
- BOOST_TEST_EQUAL("and_or", orthodox_filename("and/or"));
+ LMI_TEST_EQUAL("and_or", orthodox_filename("and/or"));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "Crime_and_or_Punishment.text"
,orthodox_filename("Crime and/or Punishment.text")
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "_Fyodor_Dostoyevskiy_Crime_and_Punishment.text"
,orthodox_filename("/Fyodor Dostoyevskiy/Crime and Punishment.text")
);
@@ -126,41 +126,41 @@ void test_orthodox_filename()
void test_serial_file_path()
{
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "Abolitionists.John_Brown.018591203.text"
,serial_file_path("Abolitionists.cns", "John Brown", 18591202,
"text").string()
);
// Serial number is zero-padded to nine positions, but can use more.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "x.000012346.y"
,serial_file_path("x.cns", "", 12345, "y").string()
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "x.123456790.y"
,serial_file_path("x.cns", "", 123456789, "y").string()
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "x.1234567891.y"
,serial_file_path("x.cns", "", 1234567890, "y").string()
);
// Input census filepath needn't have any extension.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(serial_file_path("x.ignored", "", 12345, "y").string()
,serial_file_path("x" , "", 12345, "y").string()
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "x.000012346.y"
,serial_file_path("x.ignored", "", 12345, "y").string()
);
// Discard path from input census filepath; use only leaf.
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(serial_file_path("/path/to/x", "", 12345, "y").string()
,serial_file_path("x" , "", 12345, "y").string()
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "x.000012346.y"
,serial_file_path("/path/to/x", "", 12345, "y").string()
);
@@ -190,17 +190,17 @@ void test_unique_filepath_with_normal_filenames()
std::remove(q.c_str());
write_dummy_file(p);
- BOOST_TEST_EQUAL(0, access(p.c_str(), R_OK));
+ LMI_TEST_EQUAL(0, access(p.c_str(), R_OK));
fs::path path0 = unique_filepath(fs::path(p), ".xyzzy");
- BOOST_TEST_EQUAL(path0.string(), q);
+ LMI_TEST_EQUAL(path0.string(), q);
write_dummy_file(path0);
- BOOST_TEST_EQUAL(0, access(path0.string().c_str(), R_OK));
+ LMI_TEST_EQUAL(0, access(path0.string().c_str(), R_OK));
fs::path path1 = unique_filepath(fs::path(p), ".xyzzy");
- BOOST_TEST_EQUAL(path1.string(), q);
+ LMI_TEST_EQUAL(path1.string(), q);
write_dummy_file(path1);
- BOOST_TEST_EQUAL(0, access(path1.string().c_str(), R_OK));
+ LMI_TEST_EQUAL(0, access(path1.string().c_str(), R_OK));
#if defined LMI_MSW
// This conditional block tests an msw "feature".
@@ -211,9 +211,9 @@ void test_unique_filepath_with_normal_filenames()
fs::ofstream keep_open(path1, ios_out_app_binary());
fs::path path2 = unique_filepath(fs::path(p), ".xyzzy");
- BOOST_TEST_UNEQUAL(path2.string(), q);
+ LMI_TEST_UNEQUAL(path2.string(), q);
write_dummy_file(path2);
- BOOST_TEST_EQUAL(0, access(path2.string().c_str(), R_OK));
+ LMI_TEST_EQUAL(0, access(path2.string().c_str(), R_OK));
// There's no easy way to test that unique_filepath() throws the
// exception that it should when it's reinvoked more rapidly than
@@ -239,31 +239,31 @@ void test_unique_filepath_with_normal_filenames()
// NOT: tmp + /eraseme.abc-CCYYMMDDTHHMMSSZ.abc.def
fs::path path3 = unique_filepath(fs::path(p), ".abc.def");
- BOOST_TEST_EQUAL(path3.string(), r);
+ LMI_TEST_EQUAL(path3.string(), r);
write_dummy_file(path3);
- BOOST_TEST_EQUAL(0, access(path3.string().c_str(), R_OK));
+ LMI_TEST_EQUAL(0, access(path3.string().c_str(), R_OK));
keep_open.open(path3, ios_out_app_binary());
fs::path path4 = unique_filepath(fs::path(p), ".abc.def");
- BOOST_TEST(path3.string().size() == std::string(r).size());
- BOOST_TEST(path4.string().size() == std::string(s).size());
+ LMI_TEST(path3.string().size() == std::string(r).size());
+ LMI_TEST(path4.string().size() == std::string(s).size());
keep_open.close();
// Clean up the files created by this function.
- BOOST_TEST(0 == std::remove(path3.string().c_str()));
- BOOST_TEST(0 == std::remove(path2.string().c_str()));
+ LMI_TEST(0 == std::remove(path3.string().c_str()));
+ LMI_TEST(0 == std::remove(path2.string().c_str()));
#endif // defined LMI_MSW
- BOOST_TEST(0 == std::remove(q.c_str()));
- BOOST_TEST(0 == std::remove(p.c_str()));
+ LMI_TEST(0 == std::remove(q.c_str()));
+ LMI_TEST(0 == std::remove(p.c_str()));
// Also remove the temporary directory created by this function.
//
// These calls to std::remove() fail, at least with 'wine':
-// BOOST_TEST(0 == std::remove(tmp.c_str()));
-// BOOST_TEST(0 == std::remove(tmpdir.string().c_str()));
+// LMI_TEST(0 == std::remove(tmp.c_str()));
+// LMI_TEST(0 == std::remove(tmpdir.string().c_str()));
// They return nonzero, and do not remove the directory. The
// reason is that the msw C library's remove() function doesn't
// delete directories; it sets errno to 13, which means EACCESS,
@@ -276,23 +276,23 @@ void test_unique_filepath_with_normal_filenames()
fs::remove(tmpdir);
// For std::filesystem::remove(), this is a documented
// postcondition. It does no harm to validate it here.
- BOOST_TEST(0 != access(tmpdir.string().c_str(), R_OK));
+ LMI_TEST(0 != access(tmpdir.string().c_str(), R_OK));
}
void test_unique_filepath_with_ludicrous_filenames()
{
fs::path path0 = unique_filepath(fs::path("eraseme1"), "");
- BOOST_TEST_EQUAL(path0.string(), "eraseme1");
+ LMI_TEST_EQUAL(path0.string(), "eraseme1");
fs::path path1 = unique_filepath(fs::path("eraseme2"), "");
- BOOST_TEST_EQUAL(path1.string(), "eraseme2");
+ LMI_TEST_EQUAL(path1.string(), "eraseme2");
// "" isn't likely to be a valid filename, but as a path, it's
// valid: the boost library's default path ctor constructs an
// empty path.
fs::path path2 = unique_filepath(fs::path(""), "");
- BOOST_TEST_EQUAL(path2.string(), "");
+ LMI_TEST_EQUAL(path2.string(), "");
#if defined LMI_MSW
// fs::change_extension()'s argument is ".[extension]", so ".."
@@ -301,7 +301,7 @@ void test_unique_filepath_with_ludicrous_filenames()
// called by unique_filepath() here, adding that extension to ".."
// yields "...", which is forbidden by msw, but allowed (although
// of course discouraged) by posix.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(unique_filepath(fs::path(".."), "..")
,fs::filesystem_error
,""
@@ -316,7 +316,7 @@ void test_path_inserter()
fs::path const p(z);
std::ostringstream oss;
oss << p;
- BOOST_TEST_EQUAL(z, oss.str());
+ LMI_TEST_EQUAL(z, oss.str());
}
// Ensure that operator<<() works with spaces in path.
@@ -325,7 +325,7 @@ void test_path_inserter()
fs::path const p(z);
std::ostringstream oss;
oss << p;
- BOOST_TEST_EQUAL(z, oss.str());
+ LMI_TEST_EQUAL(z, oss.str());
}
}
@@ -359,7 +359,7 @@ void test_path_validation()
// "Assertion `src.size() == std::strlen( src.c_str() )' failed."
// Perhaps std::filesystem will trap this and throw an exception.
std::string nulls = {'\0', '\0'};
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_filepath(nulls, context)
,std::runtime_error
,lmi_test::what_regex("invalid name \"<|>\" in path")
@@ -367,7 +367,7 @@ void test_path_validation()
#endif // 0
#if defined LMI_MSW
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_filepath("<|>", context)
,std::runtime_error
,lmi_test::what_regex("invalid name \"<|>\" in path")
@@ -375,28 +375,28 @@ void test_path_validation()
#endif // defined LMI_MSW
// Not empty.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_filepath("", context)
,std::runtime_error
,"Unit test file must not be empty."
);
// Must exist.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_filepath("no_such_file", context)
,std::runtime_error
,"Unit test file 'no_such_file' not found."
);
// Must be a directory.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_directory("path_utility_test_file", context)
,std::runtime_error
,"Unit test file 'path_utility_test_file' is not a directory."
);
// Must not be a directory.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(validate_filepath("path_utility_test_dir", context)
,std::runtime_error
,"Unit test file 'path_utility_test_dir' is a directory."
@@ -427,15 +427,15 @@ void test_oddities()
std::string const z1 = "Z:/opt/lmi/data";
std::string const z2 = remove_alien_msw_root(z1).string();
#if defined LMI_POSIX
- BOOST_TEST_EQUAL (z0, fs::system_complete(z0).string());
- BOOST_TEST_UNEQUAL(z0, fs::system_complete(z1).string());
- BOOST_TEST_EQUAL (z0, z2);
- BOOST_TEST_EQUAL (z0, fs::system_complete(z2).string());
+ LMI_TEST_EQUAL (z0, fs::system_complete(z0).string());
+ LMI_TEST_UNEQUAL(z0, fs::system_complete(z1).string());
+ LMI_TEST_EQUAL (z0, z2);
+ LMI_TEST_EQUAL (z0, fs::system_complete(z2).string());
#elif defined LMI_MSW
- BOOST_TEST_EQUAL (z1, fs::system_complete(z0).string());
- BOOST_TEST_EQUAL (z1, fs::system_complete(z1).string());
- BOOST_TEST_EQUAL (z1, z2);
- BOOST_TEST_EQUAL (z1, fs::system_complete(z2).string());
+ LMI_TEST_EQUAL (z1, fs::system_complete(z0).string());
+ LMI_TEST_EQUAL (z1, fs::system_complete(z1).string());
+ LMI_TEST_EQUAL (z1, z2);
+ LMI_TEST_EQUAL (z1, fs::system_complete(z2).string());
#else // Unknown platform.
throw "Unrecognized platform."
#endif // Unknown platform.
diff --git a/premium_tax_test.cpp b/premium_tax_test.cpp
index 67c56d7..545bdb4 100644
--- a/premium_tax_test.cpp
+++ b/premium_tax_test.cpp
@@ -65,34 +65,34 @@ void premium_tax_test::test_rates()
{
// arguments: tax_state, domicile, amortize_premium_load, db, strata
premium_tax z(mce_s_CT, mce_s_CT, false, db, strata);
- BOOST_TEST_EQUAL(z.levy_rate (), 0.0175);
- BOOST_TEST_EQUAL(z.load_rate (), 0.0175);
- BOOST_TEST_EQUAL(z.maximum_load_rate (), 0.0175);
- BOOST_TEST_EQUAL(z.minimum_load_rate (), 0.0175);
- BOOST_TEST_EQUAL(z.is_tiered (), false );
- BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0175);
+ LMI_TEST_EQUAL(z.levy_rate (), 0.0175);
+ LMI_TEST_EQUAL(z.load_rate (), 0.0175);
+ LMI_TEST_EQUAL(z.maximum_load_rate (), 0.0175);
+ LMI_TEST_EQUAL(z.minimum_load_rate (), 0.0175);
+ LMI_TEST_EQUAL(z.is_tiered (), false );
+ LMI_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0175);
}
// Retaliation.
{
premium_tax z(mce_s_CT, mce_s_MA, false, db, strata);
- BOOST_TEST_EQUAL(z.levy_rate (), 0.0200);
- BOOST_TEST_EQUAL(z.load_rate (), 0.0200);
- BOOST_TEST_EQUAL(z.maximum_load_rate (), 0.0200);
- BOOST_TEST_EQUAL(z.minimum_load_rate (), 0.0200);
- BOOST_TEST_EQUAL(z.is_tiered (), false );
- BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0200);
+ LMI_TEST_EQUAL(z.levy_rate (), 0.0200);
+ LMI_TEST_EQUAL(z.load_rate (), 0.0200);
+ LMI_TEST_EQUAL(z.maximum_load_rate (), 0.0200);
+ LMI_TEST_EQUAL(z.minimum_load_rate (), 0.0200);
+ LMI_TEST_EQUAL(z.is_tiered (), false );
+ LMI_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0200);
}
// Tiered.
{
premium_tax z(mce_s_AK, mce_s_CT, false, db, strata);
- BOOST_TEST_EQUAL(z.levy_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.maximum_load_rate (), 0.0270);
- BOOST_TEST_EQUAL(z.minimum_load_rate (), 0.0008);
- BOOST_TEST_EQUAL(z.is_tiered (), true );
- BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0270);
+ LMI_TEST_EQUAL(z.levy_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.maximum_load_rate (), 0.0270);
+ LMI_TEST_EQUAL(z.minimum_load_rate (), 0.0008);
+ LMI_TEST_EQUAL(z.is_tiered (), true );
+ LMI_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0270);
}
// Tiered in premium-tax state, but load uniformly zero.
@@ -109,12 +109,12 @@ void premium_tax_test::test_rates()
dictionary.datum("PremTaxLoad") = scalar;
premium_tax z(mce_s_AK, mce_s_CT, false, db, strata);
- BOOST_TEST_EQUAL(z.levy_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.maximum_load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.minimum_load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.is_tiered (), true );
- BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0000);
+ LMI_TEST_EQUAL(z.levy_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.maximum_load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.minimum_load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.is_tiered (), true );
+ LMI_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0000);
dictionary.datum("PremTaxLoad") = original;
}
@@ -122,12 +122,12 @@ void premium_tax_test::test_rates()
// Amortized.
{
premium_tax z(mce_s_CT, mce_s_MA, true , db, strata);
- BOOST_TEST_EQUAL(z.levy_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.maximum_load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.minimum_load_rate (), 0.0000);
- BOOST_TEST_EQUAL(z.is_tiered (), false );
- BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0000);
+ LMI_TEST_EQUAL(z.levy_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.maximum_load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.minimum_load_rate (), 0.0000);
+ LMI_TEST_EQUAL(z.is_tiered (), false );
+ LMI_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0000);
}
}
diff --git a/product_file_test.cpp b/product_file_test.cpp
index ea047cb..4c0739b 100644
--- a/product_file_test.cpp
+++ b/product_file_test.cpp
@@ -91,11 +91,11 @@ void product_file_test::test_copying()
// Test product_data copy ctor.
product_data q(p);
- BOOST_TEST(database_filename_ ==
AddDataDir(q.datum("DatabaseFilename")));
- BOOST_TEST(fund_filename_ == AddDataDir(q.datum("FundFilename"
)));
- BOOST_TEST(lingo_filename_ == AddDataDir(q.datum("LingoFilename"
)));
- BOOST_TEST(rounding_filename_ ==
AddDataDir(q.datum("RoundingFilename")));
- BOOST_TEST(stratified_filename_ == AddDataDir(q.datum("TierFilename"
)));
+ LMI_TEST(database_filename_ == AddDataDir(q.datum("DatabaseFilename")));
+ LMI_TEST(fund_filename_ == AddDataDir(q.datum("FundFilename" )));
+ LMI_TEST(lingo_filename_ == AddDataDir(q.datum("LingoFilename" )));
+ LMI_TEST(rounding_filename_ == AddDataDir(q.datum("RoundingFilename")));
+ LMI_TEST(stratified_filename_ == AddDataDir(q.datum("TierFilename" )));
// Test product_database move ctor.
product_database d
@@ -107,13 +107,13 @@ void product_file_test::test_copying()
,mce_nonmedical
,mce_s_CT
);
- BOOST_TEST(mce_s_CT == d.index().state());
- BOOST_TEST( 55 == d.length());
- BOOST_TEST( 99 == d.query<int>(DB_MaxIncrAge));
+ LMI_TEST(mce_s_CT == d.index().state());
+ LMI_TEST( 55 == d.length());
+ LMI_TEST( 99 == d.query<int>(DB_MaxIncrAge));
product_database e(std::move(d));
- BOOST_TEST(mce_s_CT == e.index().state());
- BOOST_TEST( 55 == e.length());
- BOOST_TEST( 99 == e.query<int>(DB_MaxIncrAge));
+ LMI_TEST(mce_s_CT == e.index().state());
+ LMI_TEST( 55 == e.length());
+ LMI_TEST( 99 == e.query<int>(DB_MaxIncrAge));
// Test product_database copy ctor.
product_database f
@@ -126,12 +126,12 @@ void product_file_test::test_copying()
,mce_s_CT
);
product_database g(f);
- BOOST_TEST(mce_s_CT == f.index().state());
- BOOST_TEST( 41 == f.length());
- BOOST_TEST( 99 == f.query<int>(DB_MaxIncrAge));
- BOOST_TEST(mce_s_CT == g.index().state());
- BOOST_TEST( 41 == g.length());
- BOOST_TEST( 99 == g.query<int>(DB_MaxIncrAge));
+ LMI_TEST(mce_s_CT == f.index().state());
+ LMI_TEST( 41 == f.length());
+ LMI_TEST( 99 == f.query<int>(DB_MaxIncrAge));
+ LMI_TEST(mce_s_CT == g.index().state());
+ LMI_TEST( 41 == g.length());
+ LMI_TEST( 99 == g.query<int>(DB_MaxIncrAge));
}
void product_file_test::read_database_file()
diff --git a/progress_meter_test.cpp b/progress_meter_test.cpp
index d220f1a..273fe7d 100644
--- a/progress_meter_test.cpp
+++ b/progress_meter_test.cpp
@@ -64,12 +64,12 @@ void progress_meter_test::test_normal_usage()
{
// Intended use: do some work, then call reflect_progress() at
// end of block, then call culminate() right after block ends.
- BOOST_TEST(meter->reflect_progress());
+ LMI_TEST(meter->reflect_progress());
// Of course, you could do more work here, too, if you like,
// but that's generally not the best idea.
}
meter->culminate();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Some title...\n"
,progress_meter_unit_test_stream().str()
);
@@ -87,7 +87,7 @@ void progress_meter_test::test_quiet_display_mode()
);
for(int i = 0; i < max_count; ++i)
{
- BOOST_TEST(meter->reflect_progress());
+ LMI_TEST(meter->reflect_progress());
}
meter->culminate();
}
@@ -106,7 +106,7 @@ void progress_meter_test::test_distinct_metered_operations()
);
for(int i = 0; i < max_count; ++i)
{
- BOOST_TEST(meter0->reflect_progress());
+ LMI_TEST(meter0->reflect_progress());
}
meter0->culminate();
@@ -120,7 +120,7 @@ void progress_meter_test::test_distinct_metered_operations()
);
for(int i = 0; i < max_count; ++i)
{
- BOOST_TEST(meter1->reflect_progress());
+ LMI_TEST(meter1->reflect_progress());
}
meter1->culminate();
@@ -132,11 +132,11 @@ void
progress_meter_test::test_distinct_metered_operations()
);
for(int i = 0; i < max_count; ++i)
{
- BOOST_TEST(meter0->reflect_progress());
+ LMI_TEST(meter0->reflect_progress());
}
meter0->culminate();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("Operation 0...\nOperation 1...\nOperation 2...\n"
,progress_meter_unit_test_stream().str()
);
@@ -155,10 +155,10 @@ void
progress_meter_test::test_empty_title_and_zero_max_count()
);
for(int i = 0; i < max_count; ++i)
{
- BOOST_TEST(meter->reflect_progress());
+ LMI_TEST(meter->reflect_progress());
}
meter->culminate();
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
("\n"
,progress_meter_unit_test_stream().str()
);
@@ -175,7 +175,7 @@ void progress_meter_test::test_postcondition_failure()
,progress_meter::e_unit_test_mode
)
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(meter->culminate()
,std::runtime_error
,"3 iterations expected, but only 0 completed."
@@ -189,20 +189,20 @@ void progress_meter_test::test_postcondition_failure()
{
throw "Thrown and caught before meter incremented.";
}
- BOOST_TEST(meter->reflect_progress());
+ LMI_TEST(meter->reflect_progress());
}
catch(...)
{
}
}
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(meter->culminate()
,std::runtime_error
,"3 iterations expected, but only 2 completed."
);
meter->reflect_progress();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(meter->reflect_progress()
,std::runtime_error
,"Progress meter maximum count exceeded."
diff --git a/rate_table_test.cpp b/rate_table_test.cpp
index 0bc36a0..e131dbf 100644
--- a/rate_table_test.cpp
+++ b/rate_table_test.cpp
@@ -172,7 +172,7 @@ Table values:
void test_database_open()
{
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(database("nonexistent")
,std::runtime_error
,lmi_test::what_regex("Unable to open 'nonexistent\\.ndx'")
@@ -183,7 +183,7 @@ void test_database_open()
std::ofstream ofs("eraseme.ndx", ios_out_trunc_binary());
ofs << ifs.rdbuf();
ofs.close();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(database("eraseme")
,std::runtime_error
,lmi_test::what_regex("Unable to open 'eraseme\\.dat'")
@@ -193,26 +193,26 @@ void test_database_open()
void test_table_access_by_index()
{
database qx_cso(qx_cso_path);
- BOOST_TEST(qx_cso_num_tables == qx_cso.tables_count());
+ LMI_TEST(qx_cso_num_tables == qx_cso.tables_count());
// Just check that using valid indices doesn't throw.
qx_cso.get_nth_table(0);
qx_cso.get_nth_table(1);
qx_cso.get_nth_table(qx_cso_num_tables - 1);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_cso.get_nth_table(-1)
,std::runtime_error
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_cso.get_nth_table(qx_cso_num_tables)
,std::out_of_range
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_cso.get_nth_table(qx_cso_num_tables + 1)
,std::out_of_range
,""
@@ -224,15 +224,15 @@ void test_table_access_by_number()
database qx_cso(qx_cso_path);
table::Number const number(qx_cso.get_nth_table(0).number());
- BOOST_TEST_EQUAL(qx_cso.find_table(number).number(), number);
+ LMI_TEST_EQUAL(qx_cso.find_table(number).number(), number);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_cso.find_table(table::Number(0))
,std::invalid_argument
,"table number 0 not found."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_cso.find_table(table::Number(0xbadf00d))
,std::invalid_argument
,"table number 195948557 not found."
@@ -245,8 +245,8 @@ void do_test_table_to_from_text(table const& table_orig)
table const table_copy = table::read_from_text(text_orig);
std::string const text_copy = table_copy.save_as_text();
- BOOST_TEST(text_orig == text_copy);
- BOOST_TEST(table_orig == table_copy);
+ LMI_TEST(text_orig == text_copy);
+ LMI_TEST(table_orig == table_copy);
}
void test_to_from_text()
@@ -265,7 +265,7 @@ void test_from_text()
// continuation of the previous line should fail.
{
std::cout << "Expect 'Possibly unknown field...':" << std::endl;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table::read_from_text("Bloordyblop: yes\n" + simple_table_text)
,std::runtime_error
,lmi_test::what_regex("expected a field name")
@@ -277,25 +277,25 @@ void test_from_text()
{
std_out_redirector std_out_redir;
table::read_from_text("Comments: no\nBloordyblop: yes\n" +
simple_table_text);
- BOOST_TEST(std_out_redir.take_output().find("Bloordyblop") !=
std::string::npos);
+ LMI_TEST(std_out_redir.take_output().find("Bloordyblop") !=
std::string::npos);
}
// Using too many values should fail.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table::read_from_text(simple_table_text + " 2 0.34567\n")
,std::runtime_error
,lmi_test::what_regex("expected a field")
);
// And so should using too few of them: chop off the last line to test.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table::read_from_text(simple_table_header + " 0 0.12345")
,std::runtime_error
,lmi_test::what_regex("missing")
);
// Using bad hash value should fail.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(table::read_from_text(simple_table_text + "Hash value: 1234567890\n")
,std::runtime_error
,lmi_test::what_regex("hash value 1234567890")
@@ -320,11 +320,11 @@ void test_save()
bool okay_ndx0 = files_are_identical("eraseme0.ndx", qx_ins_path + ".ndx");
bool okay_dat0 = files_are_identical("eraseme0.dat", qx_ins_path + ".dat");
- BOOST_TEST(okay_ndx0);
- BOOST_TEST(okay_dat0);
+ LMI_TEST(okay_ndx0);
+ LMI_TEST(okay_dat0);
database db_tmp("eraseme0");
- BOOST_TEST_EQUAL(qx_ins.tables_count(), db_tmp.tables_count());
+ LMI_TEST_EQUAL(qx_ins.tables_count(), db_tmp.tables_count());
// File 'eraseme0.dat' is still open and cannot be removed yet.
// Saving 'db_tmp' closes the file so that it can be removed.
@@ -333,19 +333,19 @@ void test_save()
// Leave the files for analysis if they didn't match.
if(okay_ndx0 && okay_dat0)
{
- BOOST_TEST(0 == std::remove("eraseme0.ndx"));
- BOOST_TEST(0 == std::remove("eraseme0.dat"));
+ LMI_TEST(0 == std::remove("eraseme0.ndx"));
+ LMI_TEST(0 == std::remove("eraseme0.dat"));
}
bool okay_ndx1 = files_are_identical("eraseme1.ndx", qx_ins_path + ".ndx");
bool okay_dat1 = files_are_identical("eraseme1.dat", qx_ins_path + ".dat");
- BOOST_TEST(okay_ndx1);
- BOOST_TEST(okay_dat1);
+ LMI_TEST(okay_ndx1);
+ LMI_TEST(okay_dat1);
// Leave the files for analysis if they didn't match.
if(okay_ndx1 && okay_dat1)
{
- BOOST_TEST(0 == std::remove("eraseme1.ndx"));
- BOOST_TEST(0 == std::remove("eraseme1.dat"));
+ LMI_TEST(0 == std::remove("eraseme1.ndx"));
+ LMI_TEST(0 == std::remove("eraseme1.dat"));
}
}
@@ -357,16 +357,16 @@ void test_add_table()
int const count = qx_ins.tables_count();
qx_ins.append_table(t);
- BOOST_TEST_EQUAL(qx_ins.tables_count(), count + 1);
+ LMI_TEST_EQUAL(qx_ins.tables_count(), count + 1);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_ins.append_table(t)
,std::invalid_argument
,"table number 1 already exists."
);
qx_ins.add_or_replace_table(t);
- BOOST_TEST_EQUAL(qx_ins.tables_count(), count + 1);
+ LMI_TEST_EQUAL(qx_ins.tables_count(), count + 1);
}
void test_delete()
@@ -374,24 +374,24 @@ void test_delete()
database qx_ins(qx_ins_path);
int const initial_count = qx_ins.tables_count();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(qx_ins.delete_table(table::Number(1))
,std::invalid_argument
,lmi_test::what_regex("not found")
);
qx_ins.delete_table(table::Number(250));
- BOOST_TEST_EQUAL(qx_ins.tables_count(), initial_count - 1);
+ LMI_TEST_EQUAL(qx_ins.tables_count(), initial_count - 1);
qx_ins.delete_table(table::Number(202));
- BOOST_TEST_EQUAL(qx_ins.tables_count(), initial_count - 2);
+ LMI_TEST_EQUAL(qx_ins.tables_count(), initial_count - 2);
test_file_eraser erase_ndx("eraseme.ndx");
test_file_eraser erase_dat("eraseme.dat");
qx_ins.save("eraseme");
database db_tmp("eraseme");
- BOOST_TEST_EQUAL(db_tmp.tables_count(), initial_count - 2);
+ LMI_TEST_EQUAL(db_tmp.tables_count(), initial_count - 2);
}
void do_test_copy(std::string const& path)
@@ -413,7 +413,7 @@ void do_test_copy(std::string const& path)
auto const orig_text = orig_table.save_as_text();
table const& new_table = table::read_from_text(orig_text);
auto const new_text = new_table.save_as_text();
- BOOST_TEST_EQUAL(new_text, orig_text);
+ LMI_TEST_EQUAL(new_text, orig_text);
db_new.append_table(new_table);
}
@@ -423,7 +423,7 @@ void do_test_copy(std::string const& path)
// And read it back.
database db_new(index_ss, data_ss);
- BOOST_TEST_EQUAL(db_new.tables_count(), tables_count);
+ LMI_TEST_EQUAL(db_new.tables_count(), tables_count);
// Compare binary rate-table files logically rather than literally.
// These files are unlikely to be identical because the order of
@@ -431,7 +431,7 @@ void do_test_copy(std::string const& path)
// same as the order in the index file.
for(int i = 0; i != tables_count; ++i)
{
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(db_new.get_nth_table(i).save_as_text()
,db_orig.get_nth_table(i).save_as_text()
);
@@ -456,26 +456,26 @@ void test_copy()
void test_decimal_deduction()
{
// 1 234567890123456
- BOOST_TEST_EQUAL( 9, deduce_number_of_decimals("0002.123456789000001"));
- BOOST_TEST_EQUAL( 8, deduce_number_of_decimals("0002.123456789999991"));
+ LMI_TEST_EQUAL( 9, deduce_number_of_decimals("0002.123456789000001"));
+ LMI_TEST_EQUAL( 8, deduce_number_of_decimals("0002.123456789999991"));
- BOOST_TEST_EQUAL( 8, deduce_number_of_decimals("0002.12345678999999 "));
- BOOST_TEST_EQUAL(13, deduce_number_of_decimals("0002.1234567899999 "));
+ LMI_TEST_EQUAL( 8, deduce_number_of_decimals("0002.12345678999999 "));
+ LMI_TEST_EQUAL(13, deduce_number_of_decimals("0002.1234567899999 "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 0.000000000000000"));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals("
0.000000000000000000000000"));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 0.000000000000000"));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals("
0.000000000000000000000000"));
// Fails, but value_cast can't return this.
-// BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 0.0 "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 0. "));
+// LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 0.0 "));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 0. "));
// Fails, but value_cast can't return this.
-// BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" .0 "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" . "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 0 "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 1 "));
- BOOST_TEST_EQUAL( 0, deduce_number_of_decimals(" 9 "));
+// LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" .0 "));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" . "));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 0 "));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 1 "));
+ LMI_TEST_EQUAL( 0, deduce_number_of_decimals(" 9 "));
// 123456789012345678
- BOOST_TEST_EQUAL( 5, deduce_number_of_decimals("0.012830000000000001"));
+ LMI_TEST_EQUAL( 5, deduce_number_of_decimals("0.012830000000000001"));
}
int test_main(int, char*[])
diff --git a/regex_test.cpp b/regex_test.cpp
index 7886a33..f1df042 100644
--- a/regex_test.cpp
+++ b/regex_test.cpp
@@ -237,20 +237,20 @@ void test_psalm_37()
std::cout << "Size of searched text: " << text .size() << '\n';
std::cout << '\n';
- BOOST_TEST( contains_regex0(early));
- BOOST_TEST( contains_regex1(early));
- BOOST_TEST( contains_regex2(early));
- BOOST_TEST( contains_regex3(early));
+ LMI_TEST( contains_regex0(early));
+ LMI_TEST( contains_regex1(early));
+ LMI_TEST( contains_regex2(early));
+ LMI_TEST( contains_regex3(early));
- BOOST_TEST( contains_regex0(late ));
- BOOST_TEST( contains_regex1(late ));
- BOOST_TEST( contains_regex2(late ));
- BOOST_TEST( contains_regex3(late ));
+ LMI_TEST( contains_regex0(late ));
+ LMI_TEST( contains_regex1(late ));
+ LMI_TEST( contains_regex2(late ));
+ LMI_TEST( contains_regex3(late ));
- BOOST_TEST(!contains_regex0(never));
- BOOST_TEST(!contains_regex1(never));
- BOOST_TEST(!contains_regex2(never));
- BOOST_TEST(!contains_regex3(never));
+ LMI_TEST(!contains_regex0(never));
+ LMI_TEST(!contains_regex1(never));
+ LMI_TEST(!contains_regex2(never));
+ LMI_TEST(!contains_regex3(never));
std::cout << " early 0: " << TimeAnAliquot(mete<0,early>) << '\n';
std::cout << " early 1: " << TimeAnAliquot(mete<1,early>) << '\n';
@@ -322,83 +322,83 @@ void test_input_sequence_regex()
// Tests that are designed to succeed.
// Simple scalars.
- BOOST_TEST( boost::regex_match("1234"
, r));
- BOOST_TEST( boost::regex_match("glp"
, r));
+ LMI_TEST( boost::regex_match("1234"
, r));
+ LMI_TEST( boost::regex_match("glp"
, r));
// Semicolon-delimited values, as expected in inforce extracts.
- BOOST_TEST( boost::regex_match("123;456;0"
, r));
+ LMI_TEST( boost::regex_match("123;456;0"
, r));
// Same, with whitespace.
- BOOST_TEST( boost::regex_match("123; 456; 0"
, r));
- BOOST_TEST( boost::regex_match("123 ;456 ;0"
, r));
- BOOST_TEST( boost::regex_match("123; 456; 0"
, r));
- BOOST_TEST( boost::regex_match("123 ;456 ;0"
, r));
- BOOST_TEST( boost::regex_match(" 123 ; 456 ; 0 "
, r));
- BOOST_TEST( boost::regex_match(" 123 ; 456 ; 0 "
, r));
+ LMI_TEST( boost::regex_match("123; 456; 0"
, r));
+ LMI_TEST( boost::regex_match("123 ;456 ;0"
, r));
+ LMI_TEST( boost::regex_match("123; 456; 0"
, r));
+ LMI_TEST( boost::regex_match("123 ;456 ;0"
, r));
+ LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 "
, r));
+ LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 "
, r));
// Same, with optional terminal semicolon.
- BOOST_TEST( boost::regex_match(" 123 ; 456 ; 0 ;"
, r));
- BOOST_TEST( boost::regex_match(" 123 ; 456 ; 0 ; "
, r));
+ LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 ;"
, r));
+ LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 ; "
, r));
// Single scalar with terminal semicolon and various whitespace.
- BOOST_TEST( boost::regex_match("123;"
, r));
- BOOST_TEST( boost::regex_match("123 ;"
, r));
- BOOST_TEST( boost::regex_match("123; "
, r));
- BOOST_TEST( boost::regex_match(" 123 ; "
, r));
+ LMI_TEST( boost::regex_match("123;"
, r));
+ LMI_TEST( boost::regex_match("123 ;"
, r));
+ LMI_TEST( boost::regex_match("123; "
, r));
+ LMI_TEST( boost::regex_match(" 123 ; "
, r));
// Negatives (e.g., "negative" loans representing repayments).
- BOOST_TEST( boost::regex_match("-987; -654"
, r));
+ LMI_TEST( boost::regex_match("-987; -654"
, r));
// Decimals.
- BOOST_TEST( boost::regex_match("0.;.0;0.0;1234.5678"
, r));
+ LMI_TEST( boost::regex_match("0.;.0;0.0;1234.5678"
, r));
// Decimals, along with '#' and '@'.
- BOOST_TEST( boost::regex_match("0.,2;.0,#3;0.0,@75;1234.5678"
, r));
+ LMI_TEST( boost::regex_match("0.,2;.0,#3;0.0,@75;1234.5678"
, r));
// Same, with whitespace.
- BOOST_TEST( boost::regex_match(" 0. , 2 ; .0 , # 3 ; 0.0 , @ 75 ;
1234.5678 " , r));
+ LMI_TEST( boost::regex_match(" 0. , 2 ; .0 , # 3 ; 0.0 , @ 75 ; 1234.5678
" , r));
// No numbers--only keywords.
- BOOST_TEST( boost::regex_match("salary,retirement;corridor,maturity"
, r));
+ LMI_TEST( boost::regex_match("salary,retirement;corridor,maturity"
, r));
// Same, with whitespace.
- BOOST_TEST( boost::regex_match(" salary , retirement; corridor ,
maturity" , r));
- BOOST_TEST( boost::regex_match(" salary , retirement; corridor ,
maturity " , r));
- BOOST_TEST( boost::regex_match(" salary , retirement ; corridor ,
maturity" , r));
- BOOST_TEST( boost::regex_match(" salary , retirement ; corridor ,
maturity " , r));
+ LMI_TEST( boost::regex_match(" salary , retirement; corridor ,
maturity" , r));
+ LMI_TEST( boost::regex_match(" salary , retirement; corridor ,
maturity " , r));
+ LMI_TEST( boost::regex_match(" salary , retirement ; corridor ,
maturity" , r));
+ LMI_TEST( boost::regex_match(" salary , retirement ; corridor ,
maturity " , r));
// Empty except for zero or more blanks.
- BOOST_TEST( boost::regex_match(""
, r));
- BOOST_TEST( boost::regex_match(" "
, r));
- BOOST_TEST( boost::regex_match(" "
, r));
+ LMI_TEST( boost::regex_match(""
, r));
+ LMI_TEST( boost::regex_match(" "
, r));
+ LMI_TEST( boost::regex_match(" "
, r));
// Interval notation.
- BOOST_TEST( boost::regex_match("1 [2,3);4 (5,6]"
, r));
+ LMI_TEST( boost::regex_match("1 [2,3);4 (5,6]"
, r));
// User-manual examples. See:
https://www.nongnu.org/lmi/sequence_input.html
- BOOST_TEST( boost::regex_match("sevenpay 7; 250000 retirement; 100000 #10;
75000 @95; 50000", r));
- BOOST_TEST( boost::regex_match("100000; 110000; 120000; 130000; 140000;
150000" , r));
- BOOST_TEST( boost::regex_match("target; maximum"
, r)); // [Modified example.]
- BOOST_TEST( boost::regex_match("10000 20; 0"
, r));
- BOOST_TEST( boost::regex_match("10000 10; 5000 15; 0"
, r));
- BOOST_TEST( boost::regex_match("10000 @70; 0"
, r));
- BOOST_TEST( boost::regex_match("10000 retirement; 0"
, r));
- BOOST_TEST( boost::regex_match("0 retirement; 5000"
, r));
- BOOST_TEST( boost::regex_match("0 retirement; 5000 maturity"
, r));
- BOOST_TEST( boost::regex_match("0 retirement; 5000 #10; 0"
, r));
- BOOST_TEST( boost::regex_match("0,[0,retirement);10000,[retirement,#10);0"
, r));
+ LMI_TEST( boost::regex_match("sevenpay 7; 250000 retirement; 100000 #10;
75000 @95; 50000", r));
+ LMI_TEST( boost::regex_match("100000; 110000; 120000; 130000; 140000;
150000" , r));
+ LMI_TEST( boost::regex_match("target; maximum"
, r)); // [Modified example.]
+ LMI_TEST( boost::regex_match("10000 20; 0"
, r));
+ LMI_TEST( boost::regex_match("10000 10; 5000 15; 0"
, r));
+ LMI_TEST( boost::regex_match("10000 @70; 0"
, r));
+ LMI_TEST( boost::regex_match("10000 retirement; 0"
, r));
+ LMI_TEST( boost::regex_match("0 retirement; 5000"
, r));
+ LMI_TEST( boost::regex_match("0 retirement; 5000 maturity"
, r));
+ LMI_TEST( boost::regex_match("0 retirement; 5000 #10; 0"
, r));
+ LMI_TEST( boost::regex_match("0,[0,retirement);10000,[retirement,#10);0"
, r));
// Tests that are designed to fail.
// Naked semicolon.
- BOOST_TEST(!boost::regex_match(";"
, r));
- BOOST_TEST(!boost::regex_match(" ; "
, r));
+ LMI_TEST(!boost::regex_match(";"
, r));
+ LMI_TEST(!boost::regex_match(" ; "
, r));
// Missing required semicolon.
- BOOST_TEST(!boost::regex_match("7 24 25"
, r));
- BOOST_TEST(!boost::regex_match("7,24,25"
, r));
- BOOST_TEST(!boost::regex_match("7, 24, 25"
, r));
- BOOST_TEST(!boost::regex_match("7 , 24 , 25"
, r));
+ LMI_TEST(!boost::regex_match("7 24 25"
, r));
+ LMI_TEST(!boost::regex_match("7,24,25"
, r));
+ LMI_TEST(!boost::regex_match("7, 24, 25"
, r));
+ LMI_TEST(!boost::regex_match("7 , 24 , 25"
, r));
// Extraneous commas.
- BOOST_TEST(!boost::regex_match(",1"
, r));
- BOOST_TEST(!boost::regex_match("1,"
, r));
- BOOST_TEST(!boost::regex_match("1,2,"
, r));
- BOOST_TEST(!boost::regex_match("1,,2"
, r));
+ LMI_TEST(!boost::regex_match(",1"
, r));
+ LMI_TEST(!boost::regex_match("1,"
, r));
+ LMI_TEST(!boost::regex_match("1,2,"
, r));
+ LMI_TEST(!boost::regex_match("1,,2"
, r));
// Impermissible character.
- BOOST_TEST(!boost::regex_match("%"
, r));
+ LMI_TEST(!boost::regex_match("%"
, r));
// Uppercase in keywords.
- BOOST_TEST(!boost::regex_match("Glp"
, r));
- BOOST_TEST(!boost::regex_match("GLP"
, r));
+ LMI_TEST(!boost::regex_match("Glp"
, r));
+ LMI_TEST(!boost::regex_match("GLP"
, r));
// Misppellings.
- BOOST_TEST(!boost::regex_match("gdp"
, r));
- BOOST_TEST(!boost::regex_match("glpp"
, r));
- BOOST_TEST(!boost::regex_match("gglp"
, r));
+ LMI_TEST(!boost::regex_match("gdp"
, r));
+ LMI_TEST(!boost::regex_match("glpp"
, r));
+ LMI_TEST(!boost::regex_match("gglp"
, r));
X = "(\\-?[0-9.]+)";
R = " *| *" + X + Y + "? *(; *" + X + Y + "? *)*;? *";
diff --git a/report_table_test.cpp b/report_table_test.cpp
index 3beadbb..ccef47a 100644
--- a/report_table_test.cpp
+++ b/report_table_test.cpp
@@ -104,50 +104,50 @@ void report_table_test::test_apportion()
std::vector<int> const votes0 = {47000, 16000, 15800, 12000, 6100, 3100};
std::vector<int> const seats0 = {5, 2, 1, 1, 1, 0};
- BOOST_TEST(seats0 == apportion(votes0, 10));
+ LMI_TEST(seats0 == apportion(votes0, 10));
std::vector<int> const votes1 = {1500, 1500, 900, 500, 500, 200};
std::vector<int> const seats1 = {7, 7, 4, 3, 3, 1};
- BOOST_TEST(seats1 == apportion(votes1, 25));
+ LMI_TEST(seats1 == apportion(votes1, 25));
std::vector<int> const seats2 = {8, 8, 5, 2, 2, 1};
- BOOST_TEST(seats2 == apportion(votes1, 26));
+ LMI_TEST(seats2 == apportion(votes1, 26));
// Test with zero total votes, to make sure that division by zero
// is averted.
std::vector<int> const votes3 = {0, 0, 0};
std::vector<int> const seats3 = {0, 0, 0};
- BOOST_TEST(seats3 == apportion(votes3, 7));
+ LMI_TEST(seats3 == apportion(votes3, 7));
// Test with vectors of one and zero elements.
std::vector<int> const votes4 = {1};
std::vector<int> const seats4 = {7};
- BOOST_TEST(seats4 == apportion(votes4, 7));
+ LMI_TEST(seats4 == apportion(votes4, 7));
std::vector<int> const votes5 = {};
std::vector<int> const seats5 = {};
- BOOST_TEST(seats5 == apportion(votes5, 7));
+ LMI_TEST(seats5 == apportion(votes5, 7));
// Test with an equal number of "voters" in each "state".
std::vector<int> const votes6 = {5, 5, 5};
std::vector<int> const seats6 = {3, 2, 2};
- BOOST_TEST(seats6 == apportion(votes6, 7));
+ LMI_TEST(seats6 == apportion(votes6, 7));
// Test with boolean vectors. This special case of the general
// algorithm is suitable for apportioning marginal space evenly
// among columns in a table.
// All space apportioned--first column gets more.
- BOOST_TEST(std::vector<int>({3, 2, 2}) == apportion({1, 1, 1}, 7));
+ LMI_TEST(std::vector<int>({3, 2, 2}) == apportion({1, 1, 1}, 7));
// Set apportionable space so that all columns get the same.
- BOOST_TEST(std::vector<int>({2, 2, 2}) == apportion({1, 1, 1}, 6));
+ LMI_TEST(std::vector<int>({2, 2, 2}) == apportion({1, 1, 1}, 6));
// Set boolean vectors so that some columns get none.
- BOOST_TEST(std::vector<int>({0, 5, 0}) == apportion({0, 1, 0}, 5));
+ LMI_TEST(std::vector<int>({0, 5, 0}) == apportion({0, 1, 0}, 5));
}
void report_table_test::test_bloat()
@@ -162,17 +162,17 @@ void report_table_test::test_bloat()
std::vector<int> const w = {3, 1, 0, 0, 2};
std::vector<bool> const e = {0, 1, 0, 1, 0};
- BOOST_TEST(v == bloat(w, e));
+ LMI_TEST(v == bloat(w, e));
// Progressively terser equivalents.
std::vector<table_column_info> x = bloat({3, 1, 0, 0, 2}, {0, 1, 0, 1, 0});
- BOOST_TEST(v == x);
+ LMI_TEST(v == x);
auto const y = bloat({3, 1, 0, 0, 2}, {0, 1, 0, 1, 0});
- BOOST_TEST(v == y);
+ LMI_TEST(v == y);
- BOOST_TEST(v == bloat({3, 1, 0, 0, 2}, {0, 1, 0, 1, 0}));
+ LMI_TEST(v == bloat({3, 1, 0, 0, 2}, {0, 1, 0, 1, 0}));
}
void report_table_test::test_column_widths_generally()
@@ -185,12 +185,12 @@ void report_table_test::test_column_widths_generally()
v = bloat({1, 2, 3}, {0, 0, 0});
observed = set_column_widths(v, 12, 2, 1);
expected = {3, 4, 5};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Same columns: same layout, even if page is much wider.
v = bloat({1, 2, 3}, {0, 0, 0});
observed = set_column_widths(v, 99, 2, 1);
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Same columns, but inadequate page width.
@@ -201,30 +201,30 @@ void report_table_test::test_column_widths_generally()
v = bloat({1, 2, 3}, {0, 0, 0});
observed = set_column_widths(v, 11, 2, 1);
expected = {3, 4, 4};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Just enough room for all data with minimum margins.
v = bloat({1, 2, 3}, {0, 0, 0});
observed = set_column_widths(v, 9, 2, 1);
expected = {2, 3, 4};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Not enough room for all data with minimum margins.
v = bloat({1, 2, 3}, {0, 0, 0});
std::cout << "Expect a diagnostic (printing 2/3 columns):\n ";
observed = set_column_widths(v, 8, 2, 1);
expected = {3, 4, 0};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Not enough room for all data, even with no margins at all.
v = bloat({1, 2, 3}, {0, 0, 0});
std::cout << "Expect a diagnostic (printing 2/3 columns):\n ";
observed = set_column_widths(v, 5, 2, 1);
expected = {2, 3, 0};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Not enough room for even the first column.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(set_column_widths(v, 1, 2, 1)
,std::runtime_error
,"Not enough room for even the first column."
@@ -232,7 +232,7 @@ void report_table_test::test_column_widths_generally()
// Report with zero columns.
v = bloat({}, {});
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(set_column_widths(v, 1, 2, 1)
,std::runtime_error
,"Report table would contain no columns."
@@ -242,46 +242,46 @@ void report_table_test::test_column_widths_generally()
v = bloat({1, 2, 3}, {0, 0, 0});
observed = set_column_widths(v, 16, 5, 3);
expected = {5, 5, 6};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// An elastic column occupies all available space not claimed by
// inelastic columns...
v = bloat({1, 2, 0, 3}, {0, 0, 1, 0});
observed = set_column_widths(v, 99, 2, 1);
expected = {3, 4, (99-12), 5};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// ...though its width might happen to be zero (PDF !! but see
// https://lists.nongnu.org/archive/html/lmi/2018-07/msg00049.html
// which questions whether zero should be allowed):
v = bloat({1, 2, 0, 3}, {0, 0, 1, 0});
observed = set_column_widths(v, 12, 2, 1);
expected = {3, 4, 0, 5};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Multiple elastic columns apportion all unclaimed space among
// themselves.
v = bloat({0, 2, 0, 3}, {1, 0, 1, 0});
observed = set_column_widths(v, 99, 2, 1);
expected = {45, 4, 45, 5};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Same, but with nonzero width specified for one elastic column.
v = bloat({1, 2, 0, 3}, {1, 0, 1, 0});
observed = set_column_widths(v, 99, 2, 1);
expected = {46, 4, 44, 5};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Elastic columns only.
v = bloat({10, 20, 30}, {1, 1, 1});
observed = set_column_widths(v, 99, 2, 1);
expected = {23, 33, 43};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
// Same columns, but all inelastic.
v = bloat({10, 20, 30}, {0, 0, 0});
observed = set_column_widths(v, 99, 2, 1);
expected = {12, 22, 32};
- BOOST_TEST(observed == expected);
+ LMI_TEST(observed == expected);
}
/// Test data for an actual group quote.
@@ -311,8 +311,8 @@ void
report_table_test::test_column_widths_for_group_quotes()
std::vector<int> const observed = set_column_widths(v, total_width,
default_margin, 1);
std::vector<int> const expected = {36, 129, 52, 62, 78, 81, 78, 81, 78,
81};
- BOOST_TEST(total_width == sum(expected));
- BOOST_TEST(observed == expected);
+ LMI_TEST(total_width == sum(expected));
+ LMI_TEST(observed == expected);
}
/// Test data for actual illustrations.
@@ -343,8 +343,8 @@ void
report_table_test::test_column_widths_for_illustrations()
std::vector<int> const observed = set_column_widths(v, total_width,
default_margin, 1);
std::vector<int> const expected = {38, 52, 67, 66, 45, 62, 62, 67};
- BOOST_TEST(sum(expected) < total_width);
- BOOST_TEST(observed == expected);
+ LMI_TEST(sum(expected) < total_width);
+ LMI_TEST(observed == expected);
}
// Fits with reduced margin.
@@ -368,8 +368,8 @@ void
report_table_test::test_column_widths_for_illustrations()
std::vector<int> const observed = set_column_widths(v, total_width,
default_margin, 1);
std::vector<int> const expected = {30, 28, 54, 36, 54, 54, 54, 54, 53, 53,
53, 53};
- BOOST_TEST(total_width == sum(expected));
- BOOST_TEST(observed == expected);
+ LMI_TEST(total_width == sum(expected));
+ LMI_TEST(observed == expected);
}
// Cannot fit.
@@ -396,11 +396,11 @@ void
report_table_test::test_column_widths_for_illustrations()
// Today, two times the default margin is added to each column,
// even though the data cannot fit.
std::vector<int> const expected = {53, 53, 53, 53, 52, 52, 52, 52, 52, 52,
52, 0};
- BOOST_TEST(total_width == sum(expected));
- BOOST_TEST(observed == expected);
+ LMI_TEST(total_width == sum(expected));
+ LMI_TEST(observed == expected);
#if 0 // Doesn't throw today, but might someday.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(set_column_widths(v, total_width, default_margin, 1)
,std::runtime_error
,"Not enough space for all 12 columns."
@@ -531,101 +531,101 @@ void report_table_test::test_paginator()
// Edge cases.
// Arguably zero rows should mean zero pages.
- BOOST_TEST_EQUAL(1, p.test( 0, 5, 28));
- BOOST_TEST_EQUAL(1, p.test( 1, 5, 28));
+ LMI_TEST_EQUAL(1, p.test( 0, 5, 28));
+ LMI_TEST_EQUAL(1, p.test( 1, 5, 28));
// Just a trivial sanity test.
- BOOST_TEST_EQUAL(1, p.test(17, 5, 28));
+ LMI_TEST_EQUAL(1, p.test(17, 5, 28));
// 4 full groups + incomplete last group.
- BOOST_TEST_EQUAL(1, p.test(24, 5, 28));
+ LMI_TEST_EQUAL(1, p.test(24, 5, 28));
// 5 full groups don't fit on one page.
- BOOST_TEST_EQUAL(2, p.test(25, 5, 28));
+ LMI_TEST_EQUAL(2, p.test(25, 5, 28));
// 4 + 4 groups + incomplete last one.
- BOOST_TEST_EQUAL(2, p.test(44, 5, 28));
+ LMI_TEST_EQUAL(2, p.test(44, 5, 28));
// 9 full groups don't fit on two pages.
- BOOST_TEST_EQUAL(3, p.test(45, 5, 28));
+ LMI_TEST_EQUAL(3, p.test(45, 5, 28));
// Test preconditions.
// Negative number of data rows.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p.test(-1, 1, 1)
,std::runtime_error
,lmi_test::what_regex("^Assertion.*failed")
);
// Zero rows per group.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p.test(1, 0, 1)
,std::logic_error
,"Rows per group must be positive."
);
// Negative number of rows per group.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p.test(1, -1, 1)
,std::logic_error
,"Rows per group must be positive."
);
// Insufficient room to print even one group.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p.test(1, 7, 3)
,std::runtime_error
,lmi_test::what_regex("^Assertion.*failed")
);
// A single row of data.
- BOOST_TEST_EQUAL(1, p.test(1, 1, 1));
- BOOST_TEST_EQUAL(1, p.test(1, 1, 3));
- BOOST_TEST_EQUAL(1, p.test(1, 3, 3));
- BOOST_TEST_EQUAL(1, p.test(1, 3, 7));
+ LMI_TEST_EQUAL(1, p.test(1, 1, 1));
+ LMI_TEST_EQUAL(1, p.test(1, 1, 3));
+ LMI_TEST_EQUAL(1, p.test(1, 3, 3));
+ LMI_TEST_EQUAL(1, p.test(1, 3, 7));
// One-row groups:
// Page length an odd number.
- BOOST_TEST_EQUAL(1, p.test(1, 1, 5));
- BOOST_TEST_EQUAL(1, p.test(3, 1, 5));
- BOOST_TEST_EQUAL(2, p.test(4, 1, 5));
- BOOST_TEST_EQUAL(2, p.test(6, 1, 5));
- BOOST_TEST_EQUAL(3, p.test(7, 1, 5));
+ LMI_TEST_EQUAL(1, p.test(1, 1, 5));
+ LMI_TEST_EQUAL(1, p.test(3, 1, 5));
+ LMI_TEST_EQUAL(2, p.test(4, 1, 5));
+ LMI_TEST_EQUAL(2, p.test(6, 1, 5));
+ LMI_TEST_EQUAL(3, p.test(7, 1, 5));
// Same, but next even length: same outcome.
- BOOST_TEST_EQUAL(1, p.test(1, 1, 6));
- BOOST_TEST_EQUAL(1, p.test(3, 1, 6));
- BOOST_TEST_EQUAL(2, p.test(4, 1, 6));
- BOOST_TEST_EQUAL(2, p.test(6, 1, 6));
- BOOST_TEST_EQUAL(3, p.test(7, 1, 6));
+ LMI_TEST_EQUAL(1, p.test(1, 1, 6));
+ LMI_TEST_EQUAL(1, p.test(3, 1, 6));
+ LMI_TEST_EQUAL(2, p.test(4, 1, 6));
+ LMI_TEST_EQUAL(2, p.test(6, 1, 6));
+ LMI_TEST_EQUAL(3, p.test(7, 1, 6));
// Two-row groups.
// Page length four.
- BOOST_TEST_EQUAL(1, p.test(1, 2, 4));
- BOOST_TEST_EQUAL(1, p.test(3, 2, 4));
- BOOST_TEST_EQUAL(2, p.test(4, 2, 4));
- BOOST_TEST_EQUAL(2, p.test(5, 2, 4));
- BOOST_TEST_EQUAL(3, p.test(6, 2, 4));
+ LMI_TEST_EQUAL(1, p.test(1, 2, 4));
+ LMI_TEST_EQUAL(1, p.test(3, 2, 4));
+ LMI_TEST_EQUAL(2, p.test(4, 2, 4));
+ LMI_TEST_EQUAL(2, p.test(5, 2, 4));
+ LMI_TEST_EQUAL(3, p.test(6, 2, 4));
// Page length five: no room for widow and orphan control.
- BOOST_TEST_EQUAL(1, p.test(1, 2, 5));
- BOOST_TEST_EQUAL(1, p.test(4, 2, 5));
- BOOST_TEST_EQUAL(2, p.test(5, 2, 5));
- BOOST_TEST_EQUAL(2, p.test(8, 2, 5));
- BOOST_TEST_EQUAL(3, p.test(9, 2, 5));
+ LMI_TEST_EQUAL(1, p.test(1, 2, 5));
+ LMI_TEST_EQUAL(1, p.test(4, 2, 5));
+ LMI_TEST_EQUAL(2, p.test(5, 2, 5));
+ LMI_TEST_EQUAL(2, p.test(8, 2, 5));
+ LMI_TEST_EQUAL(3, p.test(9, 2, 5));
// Same, but next even length: same outcome.
- BOOST_TEST_EQUAL(1, p.test(1, 2, 6));
- BOOST_TEST_EQUAL(1, p.test(4, 2, 6));
- BOOST_TEST_EQUAL(2, p.test(5, 2, 6));
- BOOST_TEST_EQUAL(2, p.test(8, 2, 6));
- BOOST_TEST_EQUAL(3, p.test(9, 2, 6));
+ LMI_TEST_EQUAL(1, p.test(1, 2, 6));
+ LMI_TEST_EQUAL(1, p.test(4, 2, 6));
+ LMI_TEST_EQUAL(2, p.test(5, 2, 6));
+ LMI_TEST_EQUAL(2, p.test(8, 2, 6));
+ LMI_TEST_EQUAL(3, p.test(9, 2, 6));
// Page length seven: one extra data row possible on last page.
- BOOST_TEST_EQUAL(1, p.test(1, 2, 7));
- BOOST_TEST_EQUAL(1, p.test(4, 2, 7));
- BOOST_TEST_EQUAL(1, p.test(5, 2, 7));
- BOOST_TEST_EQUAL(2, p.test(6, 2, 7));
- BOOST_TEST_EQUAL(2, p.test(8, 2, 7));
- BOOST_TEST_EQUAL(2, p.test(9, 2, 7));
+ LMI_TEST_EQUAL(1, p.test(1, 2, 7));
+ LMI_TEST_EQUAL(1, p.test(4, 2, 7));
+ LMI_TEST_EQUAL(1, p.test(5, 2, 7));
+ LMI_TEST_EQUAL(2, p.test(6, 2, 7));
+ LMI_TEST_EQUAL(2, p.test(8, 2, 7));
+ LMI_TEST_EQUAL(2, p.test(9, 2, 7));
std::cout << "Zero rows" << std::endl;
std::cout << test_pagination(0, 2, 7) << std::endl;
diff --git a/round_test.cpp b/round_test.cpp
index 82be3e8..1bc9011 100644
--- a/round_test.cpp
+++ b/round_test.cpp
@@ -148,7 +148,7 @@ bool test_one_case
RealType observed = roundFDL(unrounded);
// C++'s overloaded round should behave as if it calls C99's
// round(), roundf(), or roundl() as appropriate.
- BOOST_TEST_EQUAL(std::round(unrounded), observed);
+ LMI_TEST_EQUAL(std::round(unrounded), observed);
max_prec_real abs_error = std::fabs(observed - expected);
// Nonstandardly define relative error in terms of
@@ -256,9 +256,9 @@ void test_various_float_types
,long double expected
)
{
- BOOST_TEST((test_one_case(static_cast<float >(unrounded),
static_cast<float >(expected))));
- BOOST_TEST((test_one_case(static_cast<double>(unrounded),
static_cast<double>(expected))));
- BOOST_TEST((test_one_case(/* long double */ (unrounded), /* long double
*/ (expected))));
+ LMI_TEST((test_one_case(static_cast<float >(unrounded), static_cast<float
>(expected))));
+ LMI_TEST((test_one_case(static_cast<double>(unrounded),
static_cast<double>(expected))));
+ LMI_TEST((test_one_case(/* long double */ (unrounded), /* long double */
(expected))));
}
// C99 7.12.9.6: round "to the nearest integer value in floating-point
@@ -392,9 +392,9 @@ void test_rounding()
// static_cast<float>(nextafter(0.5L, 0.0L))
// need not be distinct from 0.0F.
- BOOST_TEST((test_one_case(nextafterf(0.5F, 0.0F), 0.0F)));
- BOOST_TEST((test_one_case(nextafter (0.5 , 0.0 ), 0.0 )));
- BOOST_TEST((test_one_case(nextafterl(0.5L, 0.0L), 0.0L)));
+ LMI_TEST((test_one_case(nextafterf(0.5F, 0.0F), 0.0F)));
+ LMI_TEST((test_one_case(nextafter (0.5 , 0.0 ), 0.0 )));
+ LMI_TEST((test_one_case(nextafterl(0.5L, 0.0L), 0.0L)));
}
int test_all_modes(bool synchronize)
diff --git a/round_to_test.cpp b/round_to_test.cpp
index 26a9d5f..3c66b81 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -303,9 +303,9 @@ void round_to_test::test_various_float_types
long double factor = detail::int_pow(10.0L, -decimals);
long double u = unrounded * factor;
long double e = expected * factor;
- BOOST_TEST((test_one_case(static_cast<float >(u), static_cast<float >(e),
decimals, style)));
- BOOST_TEST((test_one_case(static_cast<double>(u), static_cast<double>(e),
decimals, style)));
- BOOST_TEST((test_one_case(/* long double */ (u), /* long double */ (e),
decimals, style)));
+ LMI_TEST((test_one_case(static_cast<float >(u), static_cast<float >(e),
decimals, style)));
+ LMI_TEST((test_one_case(static_cast<double>(u), static_cast<double>(e),
decimals, style)));
+ LMI_TEST((test_one_case(/* long double */ (u), /* long double */ (e),
decimals, style)));
}
// Test rounding to various numbers of decimal places.
@@ -554,7 +554,7 @@ void round_to_test::test_fundamentals()
// Test default constructor.
round_to<double> const round_erroneously;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(round_erroneously(2.7)
,std::logic_error
,"Erroneous rounding function."
@@ -562,41 +562,41 @@ void round_to_test::test_fundamentals()
// Test copy constructor and copy assignment operator.
round_to<double> const round0(2, r_to_nearest);
- BOOST_TEST(2 == round0.decimals());
- BOOST_TEST(r_to_nearest == round0.style());
+ LMI_TEST(2 == round0.decimals());
+ LMI_TEST(r_to_nearest == round0.style());
round_to<double> round1(round0);
- BOOST_TEST(2 == round1.decimals());
- BOOST_TEST(r_to_nearest == round1.style());
+ LMI_TEST(2 == round1.decimals());
+ LMI_TEST(r_to_nearest == round1.style());
round1 = round_to<double>(3, r_toward_zero);
- BOOST_TEST(3 == round1.decimals());
- BOOST_TEST(r_toward_zero == round1.style());
+ LMI_TEST(3 == round1.decimals());
+ LMI_TEST(r_toward_zero == round1.style());
round1 = round0;
- BOOST_TEST(2 == round1.decimals());
- BOOST_TEST(r_to_nearest == round1.style());
+ LMI_TEST(2 == round1.decimals());
+ LMI_TEST(r_to_nearest == round1.style());
// Test rounding double to currency.
currency c = round0.c(1.61803398875);
- BOOST_TEST((1.62 - dblize(c)) < 1e-14);
+ LMI_TEST((1.62 - dblize(c)) < 1e-14);
#if defined USE_CURRENCY_CLASS
# if defined CURRENCY_UNIT_IS_CENTS
- BOOST_TEST_EQUAL(162, c.cents());
+ LMI_TEST_EQUAL(162, c.cents());
# else // !defined CURRENCY_UNIT_IS_CENTS
// Arguably this isn't quite meaningful:
- BOOST_TEST_EQUAL(1.62, c.cents());
+ LMI_TEST_EQUAL(1.62, c.cents());
# endif // !defined CURRENCY_UNIT_IS_CENTS
#endif // defined USE_CURRENCY_CLASS
// c *= 0.61803398875;
-// BOOST_TEST_EQUAL(1, c);
+// LMI_TEST_EQUAL(1, c);
// Test a vector.
std::vector<double> const v0 {3.1415926535, 2.718281828};
std::vector<double> const v1 {round0(v0)};
- BOOST_TEST_EQUAL(v0.size(), v1.size());
- BOOST_TEST((3.14 - v1[0]) < 1e-14);
- BOOST_TEST((2.72 - v1[1]) < 1e-14);
+ LMI_TEST_EQUAL(v0.size(), v1.size());
+ LMI_TEST((3.14 - v1[0]) < 1e-14);
+ LMI_TEST((2.72 - v1[1]) < 1e-14);
#if defined USE_CURRENCY_CLASS
// Try to provoke division by zero in ctor-initializer.
@@ -604,7 +604,7 @@ void round_to_test::test_fundamentals()
// nonstd::power() negates a negative exponent, but negating
// INT_MIN constitutes UB, so add one, plus currency::cents_digits
// because of the interplay between classes currency and round_to.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(round_to<double>(1 + currency::cents_digits + INT_MIN, r_to_nearest)
,std::domain_error
,"Invalid number of decimals."
diff --git a/rtti_lmi_test.cpp b/rtti_lmi_test.cpp
index 21e40c8..daee5ff 100644
--- a/rtti_lmi_test.cpp
+++ b/rtti_lmi_test.cpp
@@ -42,31 +42,31 @@ void RttiLmiTest::TestTypeInfo()
lmi::TypeInfo ti0(typeid(double));
lmi::TypeInfo ti1(typeid(int));
ti0 = ti1;
- BOOST_TEST(typeid(int) == *ti0.ti_);
+ LMI_TEST(typeid(int) == *ti0.ti_);
// CopyConstructible.
lmi::TypeInfo ti2(ti1);
- BOOST_TEST(typeid(int) == *ti2.ti_);
+ LMI_TEST(typeid(int) == *ti2.ti_);
// EqualityComparable.
- BOOST_TEST(ti1 == ti2);
+ LMI_TEST(ti1 == ti2);
// LessThanComparable.
- BOOST_TEST(!(ti1 < ti2));
+ LMI_TEST(!(ti1 < ti2));
// StreamInsertible.
std::ostringstream oss;
oss << ti1;
- BOOST_TEST_EQUAL(oss.str(), lmi::detail::Demangle(typeid(int).name()));
+ LMI_TEST_EQUAL(oss.str(), lmi::detail::Demangle(typeid(int).name()));
// Usable with UDTs.
ti1 = typeid(X); // Converting ctor.
- BOOST_TEST_EQUAL(ti1.Name(), lmi::detail::Demangle(typeid(X).name()));
+ LMI_TEST_EQUAL(ti1.Name(), lmi::detail::Demangle(typeid(X).name()));
// Usable with containers.
diff --git a/safely_dereference_as_test.cpp b/safely_dereference_as_test.cpp
index 769718f..6b75eeb 100644
--- a/safely_dereference_as_test.cpp
+++ b/safely_dereference_as_test.cpp
@@ -41,14 +41,14 @@ int test_main(int, char*[])
// Motivating case.
B* p = &d;
- BOOST_TEST_EQUAL(&d, &safely_dereference_as<D>(p));
+ LMI_TEST_EQUAL(&d, &safely_dereference_as<D>(p));
// Type need not be changed.
- BOOST_TEST_EQUAL(&b, &safely_dereference_as<B>(&b));
- BOOST_TEST_EQUAL(&d, &safely_dereference_as<D>(&d));
+ LMI_TEST_EQUAL(&b, &safely_dereference_as<B>(&b));
+ LMI_TEST_EQUAL(&d, &safely_dereference_as<D>(&d));
// Upcasts are forbidden: this would be a compile-time error.
-// BOOST_TEST_EQUAL( p, &safely_dereference_as<B>(&d));
+// LMI_TEST_EQUAL( p, &safely_dereference_as<B>(&d));
std::string diagnostic0;
diagnostic0 = "Cannot dereference null pointer of type '";
@@ -56,7 +56,7 @@ int test_main(int, char*[])
diagnostic0 += "'.";
D* null_pointer = nullptr;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(safely_dereference_as<D>(null_pointer)
,std::runtime_error
,diagnostic0
@@ -69,7 +69,7 @@ int test_main(int, char*[])
diagnostic1 += lmi::TypeInfo(typeid(D*)).Name();
diagnostic1 += "'.";
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(safely_dereference_as<D>(&b)
,std::runtime_error
,diagnostic1
diff --git a/snprintf_test.cpp b/snprintf_test.cpp
index 4934800..464b173 100644
--- a/snprintf_test.cpp
+++ b/snprintf_test.cpp
@@ -36,11 +36,11 @@ int test_main(int, char*[])
int len;
len = std::snprintf(nullptr, 0, "%4d", 1234);
- BOOST_TEST_EQUAL(4, len);
+ LMI_TEST_EQUAL(4, len);
// All tests in this group fail with the defective msvc rtl.
len = std::snprintf(buf, 0, "%4d", 1234);
- BOOST_TEST_EQUAL(4, len);
+ LMI_TEST_EQUAL(4, len);
// All tests in this group fail with the defective msvc rtl.
#if defined __GNUC__
@@ -48,22 +48,22 @@ int test_main(int, char*[])
# pragma GCC diagnostic ignored "-Wformat-truncation"
#endif // defined __GNUC__
len = std::snprintf(buf, 3, "%4d", 1234);
- BOOST_TEST_EQUAL(4, len);
+ LMI_TEST_EQUAL(4, len);
// This test fails with borland C++ 5.5.1 .
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string("12\0zzzzzz\0", 9));
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string("12\0zzzzzz\0", 9));
len = std::snprintf(buf, 4, "%4d", 1234);
#if defined __GNUC__
# pragma GCC diagnostic pop
#endif // defined __GNUC__
- BOOST_TEST_EQUAL(4, len);
+ LMI_TEST_EQUAL(4, len);
// This test fails with the defective msvc rtl and also
// with borland C++ 5.5.1 .
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string("123\0zzzzz\0", 9));
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string("123\0zzzzz\0", 9));
len = std::snprintf(buf, 5, "%4d", 1234);
- BOOST_TEST_EQUAL(4, len);
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string("1234\0zzzz\0", 9));
+ LMI_TEST_EQUAL(4, len);
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string("1234\0zzzz\0", 9));
long double z = 2.718281828459045L;
#if defined __GNUC__
@@ -71,36 +71,36 @@ int test_main(int, char*[])
# pragma GCC diagnostic ignored "-Wformat-truncation"
#endif // defined __GNUC__
len = std::snprintf(buf, 5, "%.5Lf", z);
- BOOST_TEST_EQUAL(7, len);
+ LMI_TEST_EQUAL(7, len);
// This should truncate to 2.71, not round to 2.72 .
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string("2.71\0zzzz\0", 9));
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string("2.71\0zzzz\0", 9));
len = std::snprintf(buf, 7, "%.5Lf", z);
#if defined __GNUC__
# pragma GCC diagnostic pop
#endif // defined __GNUC__
- BOOST_TEST_EQUAL(7, len);
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string("2.7182\0zz\0", 9));
+ LMI_TEST_EQUAL(7, len);
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string("2.7182\0zz\0", 9));
len = std::snprintf(buf, 0, "%1.12Lf", z);
- BOOST_TEST_EQUAL(14, len);
+ LMI_TEST_EQUAL(14, len);
len = std::snprintf(buf, 1 + len, "%1.12Lf", z);
- BOOST_TEST_EQUAL(14, len);
- BOOST_TEST_EQUAL(std::string(buf, 15), std::string("2.718281828459\0",
15));
+ LMI_TEST_EQUAL(14, len);
+ LMI_TEST_EQUAL(std::string(buf, 15), std::string("2.718281828459\0", 15));
// See:
// http://comments.gmane.org/gmane.comp.gnu.mingw.devel/2945
// [2008-05-11T11:46Z from François-Xavier Coudert]
double g = 39.0;
len = std::snprintf(buf, 0, "%9.0e", g);
- BOOST_TEST_EQUAL(9, len);
+ LMI_TEST_EQUAL(9, len);
len = std::snprintf(buf, 1 + len, "%9.0e", g);
- BOOST_TEST_EQUAL(9, len);
- BOOST_TEST_EQUAL(std::string(buf, 9), std::string(" 4e+01\0", 9));
+ LMI_TEST_EQUAL(9, len);
+ LMI_TEST_EQUAL(std::string(buf, 9), std::string(" 4e+01\0", 9));
double d = 1e+161;
len = std::snprintf(buf, 0, "%#.*f", 16, d);
- BOOST_TEST_EQUAL(179, len);
+ LMI_TEST_EQUAL(179, len);
len = std::snprintf(buf, 1 + len, "%#.*f", 16, d);
- BOOST_TEST_EQUAL(179, len);
+ LMI_TEST_EQUAL(179, len);
std::string e
("1"
"00000000000000000000000000000000000000000000000000"
@@ -111,7 +111,7 @@ int test_main(int, char*[])
);
// https://lists.nongnu.org/archive/html/lmi/2010-04/msg00042.html
int const number_of_digits = 16;
- BOOST_TEST(0 == e.compare(0, number_of_digits, buf, 0, number_of_digits));
+ LMI_TEST(0 == e.compare(0, number_of_digits, buf, 0, number_of_digits));
return 0;
}
diff --git a/ssize_lmi_test.cpp b/ssize_lmi_test.cpp
index bf8cf32..241d793 100644
--- a/ssize_lmi_test.cpp
+++ b/ssize_lmi_test.cpp
@@ -185,24 +185,24 @@ void test_array_bound_deduction()
void test_various_containers()
{
char const c[2] = {'0'};
- BOOST_TEST_EQUAL(lmi::ssize(c), 2);
- BOOST_TEST_EQUAL(lmi::ssize(c), bourn_cast<int>(std::size(c)));
+ LMI_TEST_EQUAL(lmi::ssize(c), 2);
+ LMI_TEST_EQUAL(lmi::ssize(c), bourn_cast<int>(std::size(c)));
std::array<int,3> const a{1, 2};
- BOOST_TEST_EQUAL(lmi::ssize(a), 3);
- BOOST_TEST_EQUAL(lmi::ssize(a), bourn_cast<int>(std::size(a)));
+ LMI_TEST_EQUAL(lmi::ssize(a), 3);
+ LMI_TEST_EQUAL(lmi::ssize(a), bourn_cast<int>(std::size(a)));
std::vector<int> const v(5);
- BOOST_TEST_EQUAL(lmi::ssize(v), 5);
- BOOST_TEST_EQUAL(lmi::ssize(v), bourn_cast<int>(std::size(v)));
+ LMI_TEST_EQUAL(lmi::ssize(v), 5);
+ LMI_TEST_EQUAL(lmi::ssize(v), bourn_cast<int>(std::size(v)));
std::string const s("abcdefg");
- BOOST_TEST_EQUAL(lmi::ssize(s), 7);
- BOOST_TEST_EQUAL(lmi::ssize(s), bourn_cast<int>(std::size(s)));
+ LMI_TEST_EQUAL(lmi::ssize(s), 7);
+ LMI_TEST_EQUAL(lmi::ssize(s), bourn_cast<int>(std::size(s)));
char const* p = "ABCDEFGHIJK";
- BOOST_TEST_EQUAL(lmi::sstrlen(p), 11);
- BOOST_TEST_EQUAL(lmi::sstrlen(p), bourn_cast<int>(std::strlen(p)));
+ LMI_TEST_EQUAL(lmi::sstrlen(p), 11);
+ LMI_TEST_EQUAL(lmi::sstrlen(p), bourn_cast<int>(std::strlen(p)));
}
int test_main(int, char*[])
diff --git a/stratified_algorithms_test.cpp b/stratified_algorithms_test.cpp
index 025ff83..950bedc 100644
--- a/stratified_algorithms_test.cpp
+++ b/stratified_algorithms_test.cpp
@@ -37,8 +37,8 @@ void banded_test()
// At limits.
- BOOST_TEST_EQUAL(0.02, banded_rate<double>()( 1000.0, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()( 5000.0, limits, rates));
+ LMI_TEST_EQUAL(0.02, banded_rate<double>()( 1000.0, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()( 5000.0, limits, rates));
// Ascertain whether limits are treated as incremental or cumulative.
// Here, they are treated as cumulative:
@@ -46,36 +46,36 @@ void banded_test()
// [1000, 5000) --> 0.02
// [5000, inf) --> 0.01
- BOOST_TEST_EQUAL(0.02, banded_rate<double>()( 4500.0, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()( 5500.0, limits, rates));
+ LMI_TEST_EQUAL(0.02, banded_rate<double>()( 4500.0, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()( 5500.0, limits, rates));
// In the interior of various brackets.
- BOOST_TEST_EQUAL(0.05, banded_rate<double>()( 900.0, limits, rates));
- BOOST_TEST_EQUAL(0.02, banded_rate<double>()( 1500.0, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()(10000.0, limits, rates));
+ LMI_TEST_EQUAL(0.05, banded_rate<double>()( 900.0, limits, rates));
+ LMI_TEST_EQUAL(0.02, banded_rate<double>()( 1500.0, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()(10000.0, limits, rates));
- BOOST_TEST(materially_equal( 45.0, banded_product<double>()( 900.0,
limits, rates)));
- BOOST_TEST(materially_equal( 30.0, banded_product<double>()( 1500.0,
limits, rates)));
- BOOST_TEST(materially_equal(100.0, banded_product<double>()(10000.0,
limits, rates)));
+ LMI_TEST(materially_equal( 45.0, banded_product<double>()( 900.0, limits,
rates)));
+ LMI_TEST(materially_equal( 30.0, banded_product<double>()( 1500.0, limits,
rates)));
+ LMI_TEST(materially_equal(100.0, banded_product<double>()(10000.0, limits,
rates)));
// With some brackets of measure zero.
std::vector<double> const z_limits {0.0, 1000.0 , 1000.0, 1000.0, 5000.0 ,
m };
std::vector<double> const z_rates {9.9, 0.05, 8.8, 7.7, 0.02,
0.01};
- BOOST_TEST(materially_equal( 30.0, banded_product<double>()( 1500.0,
z_limits, z_rates)));
+ LMI_TEST(materially_equal( 30.0, banded_product<double>()( 1500.0,
z_limits, z_rates)));
// In the vicinity of extrema.
- BOOST_TEST_EQUAL(0.05, banded_rate<double>()( 0.0, limits, rates));
- BOOST_TEST_EQUAL(0.05, banded_rate<double>()( -0.0, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()( m, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()(0.999 * m, limits, rates));
- BOOST_TEST_EQUAL(0.01, banded_rate<double>()( 0.1 * m, limits, rates));
+ LMI_TEST_EQUAL(0.05, banded_rate<double>()( 0.0, limits, rates));
+ LMI_TEST_EQUAL(0.05, banded_rate<double>()( -0.0, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()( m, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()(0.999 * m, limits, rates));
+ LMI_TEST_EQUAL(0.01, banded_rate<double>()( 0.1 * m, limits, rates));
// Precondition violations.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(-1.0, limits, rates)
,std::runtime_error
,"Assertion 'zero <= total_amount' failed."
@@ -83,27 +83,27 @@ void banded_test()
std::vector<double> const empty;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(0.0, empty, rates)
,std::runtime_error
,"Assertion '!cumulative_limits.empty()' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(0.0, limits, empty)
,std::runtime_error
,"Assertion 'rates.size() == cumulative_limits.size()' failed."
);
std::vector<double> const negative(limits.size(), -1.0);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(0.0, negative, rates)
,std::runtime_error
,"Assertion 'zero <= extrema.minimum()' failed."
);
std::vector<double> const zero(limits.size(), 0.0);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(0.0, zero, rates)
,std::runtime_error
,"Assertion 'zero < extrema.maximum()' failed."
@@ -115,7 +115,7 @@ void banded_test()
std::vector<double> decreasing(limits);
decreasing[0] = 1.0 + decreasing[1];
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(banded_rate<double>()(0.0, decreasing, rates)
,std::runtime_error
,"Assertion 'std::is_sorted(z.begin(), z.end())' failed."
@@ -130,8 +130,8 @@ void tiered_test()
// At limits.
- BOOST_TEST(materially_equal(0.0500, tiered_rate<double>()( 1000.0, limits,
rates)));
- BOOST_TEST(materially_equal(0.0275, tiered_rate<double>()( 4000.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0500, tiered_rate<double>()( 1000.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0275, tiered_rate<double>()( 4000.0, limits,
rates)));
// Ascertain whether limits are treated as incremental or cumulative.
// Here, they are treated as incremental:
@@ -139,52 +139,52 @@ void tiered_test()
// [ 1000, 1000+4000) --> 0.02
// [1000+4000, inf) --> 0.01
- BOOST_TEST(materially_equal(0.0260, tiered_rate<double>()( 5000.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0260, tiered_rate<double>()( 5000.0, limits,
rates)));
// In the interior of various brackets.
- BOOST_TEST(materially_equal(0.0500, tiered_rate<double>()( 900.0, limits,
rates)));
- BOOST_TEST(materially_equal(0.0400, tiered_rate<double>()( 1500.0, limits,
rates)));
- BOOST_TEST(materially_equal(0.0180, tiered_rate<double>()(10000.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0500, tiered_rate<double>()( 900.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0400, tiered_rate<double>()( 1500.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0180, tiered_rate<double>()(10000.0, limits,
rates)));
- BOOST_TEST(materially_equal( 45.0, tiered_product<double>()( 900.0, 0.0,
limits, rates)));
- BOOST_TEST(materially_equal( 60.0, tiered_product<double>()( 1500.0, 0.0,
limits, rates)));
- BOOST_TEST(materially_equal(180.0, tiered_product<double>()(10000.0, 0.0,
limits, rates)));
+ LMI_TEST(materially_equal( 45.0, tiered_product<double>()( 900.0, 0.0,
limits, rates)));
+ LMI_TEST(materially_equal( 60.0, tiered_product<double>()( 1500.0, 0.0,
limits, rates)));
+ LMI_TEST(materially_equal(180.0, tiered_product<double>()(10000.0, 0.0,
limits, rates)));
// With nonzero second argument to tiered_product().
- BOOST_TEST(materially_equal( 0.0, tiered_product<double>()( 0.0,
10000.0, limits, rates)));
- BOOST_TEST(materially_equal( 10.0, tiered_product<double>()( 1000.0,
9000.0, limits, rates)));
- BOOST_TEST(materially_equal( 50.0, tiered_product<double>()( 5000.0,
5000.0, limits, rates)));
+ LMI_TEST(materially_equal( 0.0, tiered_product<double>()( 0.0,
10000.0, limits, rates)));
+ LMI_TEST(materially_equal( 10.0, tiered_product<double>()( 1000.0,
9000.0, limits, rates)));
+ LMI_TEST(materially_equal( 50.0, tiered_product<double>()( 5000.0,
5000.0, limits, rates)));
- BOOST_TEST(materially_equal( 10.0, tiered_product<double>()( 500.0,
1000.0, limits, rates)));
+ LMI_TEST(materially_equal( 10.0, tiered_product<double>()( 500.0,
1000.0, limits, rates)));
- BOOST_TEST(materially_equal( 5.0, tiered_product<double>()( 100.0,
100.0, limits, rates)));
- BOOST_TEST(materially_equal(175.0, tiered_product<double>()( 9900.0,
100.0, limits, rates)));
+ LMI_TEST(materially_equal( 5.0, tiered_product<double>()( 100.0,
100.0, limits, rates)));
+ LMI_TEST(materially_equal(175.0, tiered_product<double>()( 9900.0,
100.0, limits, rates)));
// With some brackets of measure zero.
std::vector<double> const z_limits {0.0, 1000.0 , 0.0, 0.0, 4000.0 , m };
std::vector<double> const z_rates {9.9, 0.05, 8.8, 7.7, 0.02, 0.01};
- BOOST_TEST(materially_equal(175.0, tiered_product<double>()( 9900.0,
100.0, z_limits, z_rates)));
+ LMI_TEST(materially_equal(175.0, tiered_product<double>()( 9900.0,
100.0, z_limits, z_rates)));
// In the vicinity of extrema.
- BOOST_TEST(materially_equal(0.0500, tiered_rate<double>()( 0.0,
limits, rates)));
- BOOST_TEST(materially_equal(0.0500, tiered_rate<double>()( -0.0,
limits, rates)));
- BOOST_TEST(materially_equal(0.0100, tiered_rate<double>()( m,
limits, rates)));
- BOOST_TEST(materially_equal(0.0100, tiered_rate<double>()(0.999 * m,
limits, rates)));
- BOOST_TEST(materially_equal(0.0100, tiered_rate<double>()( 0.1 * m,
limits, rates)));
+ LMI_TEST(materially_equal(0.0500, tiered_rate<double>()( 0.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0500, tiered_rate<double>()( -0.0, limits,
rates)));
+ LMI_TEST(materially_equal(0.0100, tiered_rate<double>()( m, limits,
rates)));
+ LMI_TEST(materially_equal(0.0100, tiered_rate<double>()(0.999 * m, limits,
rates)));
+ LMI_TEST(materially_equal(0.0100, tiered_rate<double>()( 0.1 * m, limits,
rates)));
// Precondition violations.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(-1.0, 0.0, limits, rates)
,std::runtime_error
,"Assertion 'zero <= new_incremental_amount' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(0.0, -1.0, limits, rates)
,std::runtime_error
,"Assertion 'zero <= prior_total_amount' failed."
@@ -192,27 +192,27 @@ void tiered_test()
std::vector<double> const empty;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(0.0, 0.0, empty, rates)
,std::runtime_error
,"Assertion '!incremental_limits.empty()' failed."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(0.0, 0.0, limits, empty)
,std::runtime_error
,"Assertion 'rates.size() == incremental_limits.size()' failed."
);
std::vector<double> const negative(limits.size(), -1.0);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(0.0, 0.0, negative, rates)
,std::runtime_error
,"Assertion 'zero <= extrema.minimum()' failed."
);
std::vector<double> const zero(limits.size(), 0.0);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(tiered_product<double>()(0.0, 0.0, zero, rates)
,std::runtime_error
,"Assertion 'zero < extrema.maximum()' failed."
@@ -235,47 +235,47 @@ void progressively_limit_test()
a = 2; b = 3; z = 6;
progressively_limit(a, b, z);
- BOOST_TEST( 2 == a && 3 == b);
+ LMI_TEST( 2 == a && 3 == b);
a = 2; b = 3; z = 5;
progressively_limit(a, b, z);
- BOOST_TEST( 2 == a && 3 == b);
+ LMI_TEST( 2 == a && 3 == b);
a = 2; b = 3; z = 4;
progressively_limit(a, b, z);
- BOOST_TEST( 1 == a && 3 == b);
+ LMI_TEST( 1 == a && 3 == b);
a = 2; b = 3; z = 3;
progressively_limit(a, b, z);
- BOOST_TEST( 0 == a && 3 == b);
+ LMI_TEST( 0 == a && 3 == b);
a = 2; b = 3; z = 2;
progressively_limit(a, b, z);
- BOOST_TEST( 0 == a && 2 == b);
+ LMI_TEST( 0 == a && 2 == b);
a = 2; b = 3; z = 1;
progressively_limit(a, b, z);
- BOOST_TEST( 0 == a && 1 == b);
+ LMI_TEST( 0 == a && 1 == b);
a = 2; b = 3; z = 0;
progressively_limit(a, b, z);
- BOOST_TEST( 0 == a && 0 == b);
+ LMI_TEST( 0 == a && 0 == b);
a = 0; b = 0; z = 1;
progressively_limit(a, b, z);
- BOOST_TEST( 0 == a && 0 == b);
+ LMI_TEST( 0 == a && 0 == b);
a = -1; b = -1; z = 1;
progressively_limit(a, b, z);
- BOOST_TEST(-1 == a && -1 == b);
+ LMI_TEST(-1 == a && -1 == b);
a = -1; b = 3; z = 1;
progressively_limit(a, b, z);
- BOOST_TEST(-1 == a && 2 == b);
+ LMI_TEST(-1 == a && 2 == b);
a = 3; b = -1; z = 1;
progressively_limit(a, b, z);
- BOOST_TEST( 2 == a && -1 == b);
+ LMI_TEST( 2 == a && -1 == b);
// TODO ?? It would seem wise to test floating point too.
}
@@ -291,278 +291,278 @@ void progressively_reduce_test()
a = -2; b = -3; z = 6;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && -3 == b && 6 == r);
+ LMI_TEST(-2 == a && -3 == b && 6 == r);
a = -2; b = -3; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && -3 == b && 1 == r);
+ LMI_TEST(-2 == a && -3 == b && 1 == r);
a = -2; b = -3; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && -3 == b && 0 == r);
+ LMI_TEST(-2 == a && -3 == b && 0 == r);
a = -2; b = -3; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && -3 == b && 0 == r);
+ LMI_TEST(-2 == a && -3 == b && 0 == r);
a = -2; b = -3; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-1 == a && -3 == b && 0 == r);
+ LMI_TEST(-1 == a && -3 == b && 0 == r);
a = -2; b = -3; z = -2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 0 == r);
+ LMI_TEST( 0 == a && -3 == b && 0 == r);
a = -2; b = -3; z = -3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -2 == b && 0 == r);
+ LMI_TEST( 0 == a && -2 == b && 0 == r);
a = -2; b = -3; z = -4;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -1 == b && 0 == r);
+ LMI_TEST( 0 == a && -1 == b && 0 == r);
a = -2; b = -3; z = -5;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -2; b = -3; z = -6;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 0 == b && 0 == r);
+ LMI_TEST( 1 == a && 0 == b && 0 == r);
// {positive, positive}
a = 2; b = 3; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && 3 == b && 0 == r);
+ LMI_TEST( 2 == a && 3 == b && 0 == r);
a = 2; b = 3; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && 3 == b && 0 == r);
+ LMI_TEST( 2 == a && 3 == b && 0 == r);
a = 2; b = 3; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 3 == a && 3 == b && 0 == r);
+ LMI_TEST( 3 == a && 3 == b && 0 == r);
a = 2; b = 3; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 3 == b && 0 == r);
+ LMI_TEST( 1 == a && 3 == b && 0 == r);
a = 2; b = 3; z = 2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 3 == b && 0 == r);
+ LMI_TEST( 0 == a && 3 == b && 0 == r);
a = 2; b = 3; z = 3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 2 == b && 0 == r);
+ LMI_TEST( 0 == a && 2 == b && 0 == r);
a = 2; b = 3; z = 4;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 1 == b && 0 == r);
+ LMI_TEST( 0 == a && 1 == b && 0 == r);
a = 2; b = 3; z = 5;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = 2; b = 3; z = 6;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 1 == r);
+ LMI_TEST( 0 == a && 0 == b && 1 == r);
// {negative, positive}
a = -2; b = 3; z = 4;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 0 == b && 1 == r);
+ LMI_TEST(-2 == a && 0 == b && 1 == r);
a = -2; b = 3; z = 3;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 0 == b && 0 == r);
+ LMI_TEST(-2 == a && 0 == b && 0 == r);
a = -2; b = 3; z = 2;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 1 == b && 0 == r);
+ LMI_TEST(-2 == a && 1 == b && 0 == r);
a = -2; b = 3; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 2 == b && 0 == r);
+ LMI_TEST(-2 == a && 2 == b && 0 == r);
a = -2; b = 3; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 3 == b && 0 == r);
+ LMI_TEST(-2 == a && 3 == b && 0 == r);
a = -2; b = 3; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 3 == b && 0 == r);
+ LMI_TEST(-2 == a && 3 == b && 0 == r);
a = -2; b = 3; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-1 == a && 3 == b && 0 == r);
+ LMI_TEST(-1 == a && 3 == b && 0 == r);
a = -2; b = 3; z = -2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 3 == b && 0 == r);
+ LMI_TEST( 0 == a && 3 == b && 0 == r);
a = -2; b = 3; z = -3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 3 == b && 0 == r);
+ LMI_TEST( 1 == a && 3 == b && 0 == r);
// {positive, negative}
a = 2; b = -3; z = 3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 1 == r);
+ LMI_TEST( 0 == a && -3 == b && 1 == r);
a = 2; b = -3; z = 2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 0 == r);
+ LMI_TEST( 0 == a && -3 == b && 0 == r);
a = 2; b = -3; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && -3 == b && 0 == r);
+ LMI_TEST( 1 == a && -3 == b && 0 == r);
a = 2; b = -3; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && -3 == b && 0 == r);
+ LMI_TEST( 2 == a && -3 == b && 0 == r);
a = 2; b = -3; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && -3 == b && 0 == r);
+ LMI_TEST( 2 == a && -3 == b && 0 == r);
a = 2; b = -3; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && -2 == b && 0 == r);
+ LMI_TEST( 2 == a && -2 == b && 0 == r);
a = 2; b = -3; z = -2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && -1 == b && 0 == r);
+ LMI_TEST( 2 == a && -1 == b && 0 == r);
a = 2; b = -3; z = -3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 2 == a && 0 == b && 0 == r);
+ LMI_TEST( 2 == a && 0 == b && 0 == r);
a = 2; b = -3; z = -4;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 3 == a && 0 == b && 0 == r);
+ LMI_TEST( 3 == a && 0 == b && 0 == r);
// {0, negative}
a = 0; b = -3; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 1 == r);
+ LMI_TEST( 0 == a && -3 == b && 1 == r);
a = 0; b = -3; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 0 == r);
+ LMI_TEST( 0 == a && -3 == b && 0 == r);
a = 0; b = -3; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -3 == b && 0 == r);
+ LMI_TEST( 0 == a && -3 == b && 0 == r);
a = 0; b = -3; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && -2 == b && 0 == r);
+ LMI_TEST( 0 == a && -2 == b && 0 == r);
a = 0; b = -3; z = -3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = 0; b = -3; z = -4;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 0 == b && 0 == r);
+ LMI_TEST( 1 == a && 0 == b && 0 == r);
// {negative, 0}
a = -2; b = 0; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 0 == b && 1 == r);
+ LMI_TEST(-2 == a && 0 == b && 1 == r);
a = -2; b = 0; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 0 == b && 0 == r);
+ LMI_TEST(-2 == a && 0 == b && 0 == r);
a = -2; b = 0; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-2 == a && 0 == b && 0 == r);
+ LMI_TEST(-2 == a && 0 == b && 0 == r);
a = -2; b = 0; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST(-1 == a && 0 == b && 0 == r);
+ LMI_TEST(-1 == a && 0 == b && 0 == r);
a = -2; b = 0; z = -2;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -2; b = 0; z = -3;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 0 == b && 0 == r);
+ LMI_TEST( 1 == a && 0 == b && 0 == r);
// {0, 0}
a = 0; b = 0; z = -1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 1 == a && 0 == b && 0 == r);
+ LMI_TEST( 1 == a && 0 == b && 0 == r);
a = 0; b = 0; z = 1;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 1 == r);
+ LMI_TEST( 0 == a && 0 == b && 1 == r);
// {signed 0, signed 0}
a = 0; b = 0; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = 0; b = 0; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = 0; b = -0; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = 0; b = -0; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -0; b = 0; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -0; b = 0; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -0; b = -0; z = 0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
a = -0; b = -0; z = -0;
r = progressively_reduce(a, b, z);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
// Make sure we can pass an rvalue as the third argument.
a = 1; b = 2;
r = progressively_reduce(a, b, 3);
- BOOST_TEST( 0 == a && 0 == b && 0 == r);
+ LMI_TEST( 0 == a && 0 == b && 0 == r);
// These values are designed to fail with IEC 60559:1989 64-bit doubles.
double ad, bd, zd, rd;
ad = 0.03; bd = 0.04; zd = 0.07;
rd = progressively_reduce(ad, bd, zd);
// This is likely to fail with 'rd' being something like 6.93889e-18:
- // BOOST_TEST(0.0 == ad && 0.0 == bd && 0.0 == rd);
+ // LMI_TEST(0.0 == ad && 0.0 == bd && 0.0 == rd);
// We can expect only that it's within a tolerance of
// machine epsilon
// times largest value
// times number of operations (taken approximately as ten).
double t = 10.0 * zd * std::numeric_limits<double>::epsilon();
- BOOST_TEST(std::fabs(ad) < t && std::fabs(bd) < t && std::fabs(rd) < t);
+ LMI_TEST(std::fabs(ad) < t && std::fabs(bd) < t && std::fabs(rd) < t);
// Here, delta is less than the sum of the first two arguments,
// but greater than the first alone, so the first argument and
// the returned remainder should both be reduced to exactly zero.
ad = 0.0301; bd = 0.1110; zd = 0.0711;
rd = progressively_reduce(ad, bd, zd);
- BOOST_TEST(0.0 == ad && materially_equal(0.07, bd) && 0.0 == rd);
+ LMI_TEST(0.0 == ad && materially_equal(0.07, bd) && 0.0 == rd);
}
int test_main(int, char*[])
diff --git a/stream_cast_test.cpp b/stream_cast_test.cpp
index e0cf766..6a62e36 100644
--- a/stream_cast_test.cpp
+++ b/stream_cast_test.cpp
@@ -75,8 +75,8 @@ int test_main(int, char*[])
// Induce failure in ostream inserter:
std::stringstream ss0;
ss0 << static_cast<std::streambuf*>(nullptr);
- BOOST_TEST(!ss0);
- BOOST_TEST_THROW
+ LMI_TEST(!ss0);
+ LMI_TEST_THROW
(stream_cast<std::string>(static_cast<std::streambuf*>(nullptr))
,std::runtime_error
,lmi_test::what_regex("^Failure in ostream inserter")
@@ -85,31 +85,31 @@ int test_main(int, char*[])
// Induce failure in istream extractor:
std::stringstream ss1;
ss1 << "3";
- BOOST_TEST(! !ss1);
+ LMI_TEST(! !ss1);
bool b {0};
ss1 >> b;
- BOOST_TEST(!ss1);
- BOOST_TEST_THROW
+ LMI_TEST(!ss1);
+ LMI_TEST_THROW
(stream_cast<bool>("3")
,std::runtime_error
,lmi_test::what_regex("^Failure in istream extractor")
);
// Throw if any trailing input remains...
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(stream_cast<double>("3.14 59")
,std::runtime_error
,lmi_test::what_regex("^Unconverted data remains")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(stream_cast<double>("3.14\r59")
,std::runtime_error
,lmi_test::what_regex("^Unconverted data remains")
);
// ...unless it's all whitespace...
- BOOST_TEST_EQUAL(2, stream_cast<int>("2\r"));
+ LMI_TEST_EQUAL(2, stream_cast<int>("2\r"));
// ...as designated by blank_is_not_whitespace_locale()
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(stream_cast<double>("3.14 ")
,std::runtime_error
,lmi_test::what_regex("^Unconverted data remains")
@@ -124,45 +124,45 @@ int test_main(int, char*[])
// string-like classes.
s = stream_cast<std::string>(s);
- BOOST_TEST(s.empty());
+ LMI_TEST(s.empty());
- BOOST_TEST_EQUAL("", stream_cast<std::string>(""));
+ LMI_TEST_EQUAL("", stream_cast<std::string>(""));
s = "Not empty.";
std::string empty("");
s = stream_cast<std::string>(empty);
- BOOST_TEST_EQUAL("", s);
+ LMI_TEST_EQUAL("", s);
- BOOST_TEST_EQUAL( "Z" , stream_cast<std::string>( "Z" ));
- BOOST_TEST_EQUAL(" Z" , stream_cast<std::string>(" Z" ));
- BOOST_TEST_EQUAL( "Z ", stream_cast<std::string>( "Z "));
- BOOST_TEST_EQUAL(" Z ", stream_cast<std::string>(" Z "));
+ LMI_TEST_EQUAL( "Z" , stream_cast<std::string>( "Z" ));
+ LMI_TEST_EQUAL(" Z" , stream_cast<std::string>(" Z" ));
+ LMI_TEST_EQUAL( "Z ", stream_cast<std::string>( "Z "));
+ LMI_TEST_EQUAL(" Z ", stream_cast<std::string>(" Z "));
char* c0 = const_cast<char*>("as df"); // Cast avoids 4.2/2 warning.
s = stream_cast<std::string>(c0);
- BOOST_TEST_EQUAL("as df", s);
+ LMI_TEST_EQUAL("as df", s);
char const* c1 = "jk l;";
s = stream_cast(c1, s);
- BOOST_TEST_EQUAL("jk l;", s);
+ LMI_TEST_EQUAL("jk l;", s);
std::string s0 = " !@ #$% ";
s = stream_cast<std::string>(s0);
- BOOST_TEST_EQUAL(" !@ #$% ", s);
+ LMI_TEST_EQUAL(" !@ #$% ", s);
std::string const s1 = " ^& *() ";
s = stream_cast(s1, s);
- BOOST_TEST_EQUAL(" ^& *() ", s);
+ LMI_TEST_EQUAL(" ^& *() ", s);
std::string const& r0(s0);
s = stream_cast<std::string>(r0);
- BOOST_TEST_EQUAL(" !@ #$% ", s);
+ LMI_TEST_EQUAL(" !@ #$% ", s);
std::string const& r1(s1);
s = stream_cast(r1, s);
- BOOST_TEST_EQUAL(" ^& *() ", s);
+ LMI_TEST_EQUAL(" ^& *() ", s);
s = stream_cast(r0, s);
- BOOST_TEST_EQUAL(" !@ #$% ", s);
+ LMI_TEST_EQUAL(" !@ #$% ", s);
s = stream_cast(r1, r1);
- BOOST_TEST_EQUAL(" ^& *() ", s);
+ LMI_TEST_EQUAL(" ^& *() ", s);
// Attempting to construct a std::string from a null pointer to
// char or char const elicits undefined behavior. The volatile
@@ -172,13 +172,13 @@ int test_main(int, char*[])
//
http://groups.google.com/group/comp.lang.c++.moderated/msg/6022d0bc84207ff1
// explains, a conversion to bool is used instead.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(stream_cast<std::string>(static_cast<char*>(nullptr))
,std::runtime_error
,"Cannot convert (char*)(0) to std::string."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(stream_cast<std::string>(static_cast<char const*>(nullptr))
,std::runtime_error
,"Cannot convert (char const*)(0) to std::string."
diff --git a/system_command_test.cpp b/system_command_test.cpp
index bb71dcf..b5d0c03 100644
--- a/system_command_test.cpp
+++ b/system_command_test.cpp
@@ -41,7 +41,7 @@ int test_main(int, char*[])
system_command("lmi_md5sum --check --status eraseme.md5");
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(system_command("lmi_md5sum --check --status eraseme")
,std::runtime_error
,lmi_test::what_regex
@@ -55,7 +55,7 @@ int test_main(int, char*[])
#else // defined LMI_MSW
lmi_test::what_regex bad_cmd("Exit code 12345 from command 'xyzzy'.");
#endif // defined LMI_MSW
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(system_command("xyzzy")
,std::runtime_error
,bad_cmd
diff --git a/test_main.cpp b/test_main.cpp
index e76ff26..8e8006c 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -125,7 +125,7 @@ namespace lmi_test
/// Preserve regex ctor argument so stream inserter can write it.
///
/// The sole motivation for this simple std::regex wrapper is to
- /// let BOOST_TEST_THROW print the regex in diagnostics like:
+ /// let LMI_TEST_THROW print the regex in diagnostics like:
/// "Caught 'XYZ' but expected '[0-9]*'."
class what_regex
diff --git a/test_tools.hpp b/test_tools.hpp
index 48ab5b5..eaa217d 100644
--- a/test_tools.hpp
+++ b/test_tools.hpp
@@ -69,12 +69,12 @@
// These are macros for the same reason that 'assert' is.
-#define BOOST_TEST_FLUSH \
+#define LMI_TEST_FLUSH \
"\n[file " << __FILE__ \
<< ", line " << __LINE__ << "]\n" \
<< std::flush \
-#define BOOST_TEST(exp) \
+#define LMI_TEST(exp) \
if(exp) \
{ \
lmi_test::record_success(); \
@@ -84,19 +84,19 @@
lmi_test::record_error(); \
lmi_test::error_stream() \
<< (exp) \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
} \
// Relational macros require their arguments to be streamable.
-#define BOOST_TEST_EQUAL(a,b) \
- BOOST_TEST_RELATION(a,==,b) \
+#define LMI_TEST_EQUAL(a,b) \
+ LMI_TEST_RELATION(a,==,b) \
-#define BOOST_TEST_UNEQUAL(a,b) \
- BOOST_TEST_RELATION(a,!=,b) \
+#define LMI_TEST_UNEQUAL(a,b) \
+ LMI_TEST_RELATION(a,!=,b) \
-#define BOOST_TEST_RELATION(a,op,b) \
+#define LMI_TEST_RELATION(a,op,b) \
if((a) op (b)) \
lmi_test::record_success(); \
else \
@@ -104,7 +104,7 @@
lmi_test::record_error(); \
lmi_test::error_stream() \
<< " '" << (a) << "' "#op" '" << (b) << "'" \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
} \
@@ -112,7 +112,7 @@ namespace lmi_test
{
/// Judge whether what() matches macro argument WHAT acceptably.
///
-/// Intended to be called only by BOOST_TEST_THROW(). Arguments:
+/// Intended to be called only by LMI_TEST_THROW(). Arguments:
/// - observed: the what() string actually thrown;
/// - expected: macro argument 'WHAT', the string anticipated.
///
@@ -148,7 +148,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
/// - lmi_test::whats_what() deems the observed what() equivalent to
/// macro argument WHAT.
-#define BOOST_TEST_THROW(expression,TYPE,WHAT) \
+#define LMI_TEST_THROW(expression,TYPE,WHAT) \
try \
{ \
expression; \
@@ -158,7 +158,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
<< "' failed to throw expected exception '" \
<< #TYPE \
<< "'" \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
lmi_test::record_error(); \
} \
@@ -172,7 +172,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
<< "'\n when type\n '" \
<< typeid(TYPE).name() \
<< "'\n was expected." \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
lmi_test::record_error(); \
} \
@@ -184,7 +184,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
<< "'\n when\n '" \
<< (WHAT) \
<< "'\n was expected." \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
lmi_test::record_error(); \
} \
@@ -194,7 +194,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
} \
} \
-#define INVOKE_BOOST_TEST(exp,file,line) \
+#define INVOKE_LMI_TEST(exp,file,line) \
if(!(exp)) \
{ \
lmi_test::record_error(); \
@@ -206,19 +206,19 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
<< "file " << (file) << ", " \
<< "line: " << (line) \
<< "]" \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
} \
else \
lmi_test::record_success(); \
-#define INVOKE_BOOST_TEST_EQUAL(a,b,file,line) \
- INVOKE_BOOST_TEST_RELATION(a,==,b,file,line) \
+#define INVOKE_LMI_TEST_EQUAL(a,b,file,line) \
+ INVOKE_LMI_TEST_RELATION(a,==,b,file,line) \
-#define INVOKE_BOOST_TEST_UNEQUAL(a,b,file,line) \
- INVOKE_BOOST_TEST_RELATION(a,!=,b,file,line) \
+#define INVOKE_LMI_TEST_UNEQUAL(a,b,file,line) \
+ INVOKE_LMI_TEST_RELATION(a,!=,b,file,line) \
-#define INVOKE_BOOST_TEST_RELATION(a,op,b,file,line) \
+#define INVOKE_LMI_TEST_RELATION(a,op,b,file,line) \
if((a) op (b)) \
lmi_test::record_success(); \
else \
@@ -230,7 +230,7 @@ bool whats_what(std::string const& observed, what_regex
const& expected);
<< "file " << (file) << ", " \
<< "line: " << (line) \
<< "]" \
- << BOOST_TEST_FLUSH \
+ << LMI_TEST_FLUSH \
; \
} \
@@ -250,7 +250,7 @@ namespace lmi_test
// of adding more reporting functions, it presents a std::ostream
// for versatility and clarity.
//
- // Rationale: An alternative implementation of BOOST_TEST_THROW
+ // Rationale: An alternative implementation of LMI_TEST_THROW
// was written to determine how much work could be delegated to
// functions without reporting less information. Because the
// 'expression' parameter can be a simple semicolon, it must be a
diff --git a/test_tools_test.cpp b/test_tools_test.cpp
index a4bd61f..cfed502 100644
--- a/test_tools_test.cpp
+++ b/test_tools_test.cpp
@@ -31,9 +31,9 @@ bool volatile always_false = false;
void test_function(bool a, bool b, char const* file, int line)
{
- INVOKE_BOOST_TEST(a, file, line);
- INVOKE_BOOST_TEST_EQUAL(a, b, file, line);
- INVOKE_BOOST_TEST_UNEQUAL(a, b, file, line);
+ INVOKE_LMI_TEST(a, file, line);
+ INVOKE_LMI_TEST_EQUAL(a, b, file, line);
+ INVOKE_LMI_TEST_UNEQUAL(a, b, file, line);
}
// Throw an exception unconditionally, while preventing compilers from
@@ -56,29 +56,28 @@ int test_main(int, char*[])
lmi_test::error_prefix = "\n#### ";
- BOOST_TEST(always_true);
- BOOST_TEST(always_false);
+ LMI_TEST(always_true);
+ LMI_TEST(always_false);
- BOOST_TEST_EQUAL(always_true, always_true );
- BOOST_TEST_EQUAL(always_true, always_false);
+ LMI_TEST_EQUAL(always_true, always_true );
+ LMI_TEST_EQUAL(always_true, always_false);
- BOOST_TEST_UNEQUAL(always_true, always_true );
- BOOST_TEST_UNEQUAL(always_true, always_false);
+ LMI_TEST_UNEQUAL(always_true, always_true );
+ LMI_TEST_UNEQUAL(always_true, always_false);
test_function(always_true , always_true, __FILE__, __LINE__);
test_function(always_false, always_true, __FILE__, __LINE__);
+ LMI_TEST_THROW((void)(0), std::runtime_error, "arbitrary");
+ LMI_TEST_THROW(;, std::runtime_error, "arbitrary");
- BOOST_TEST_THROW((void)(0), std::runtime_error, "arbitrary");
- BOOST_TEST_THROW(;, std::runtime_error, "arbitrary");
-
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(throw_exception(std::runtime_error("arbitrary"))
,std::logic_error
,"arbitrary"
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(throw_exception(std::runtime_error("wrong what_arg"))
,std::runtime_error
,"right what_arg"
@@ -104,7 +103,7 @@ int test_main(int, char*[])
// terminal substring beginning with "\n[file ", which some lmi
// exceptions add.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(throw_exception
(std::runtime_error
("arbitrary"
@@ -117,7 +116,7 @@ int test_main(int, char*[])
// Test exception::what() against a regular expression.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(throw_exception(std::runtime_error("Iteration 31: failure."))
,std::runtime_error
,lmi_test::what_regex("^Iteration [0-9]*: failure\\.$")
@@ -132,21 +131,21 @@ int test_main(int, char*[])
// unimportant to specify an actual expectation when the test was
// written. It doesn't mean that an empty what-string is expected;
// it only means that any what-string is accepted.
- BOOST_TEST( lmi_test::whats_what(observed, ""));
+ LMI_TEST( lmi_test::whats_what(observed, ""));
// A full exact match is accepted [and here '.*$' is no regex]:
- BOOST_TEST( lmi_test::whats_what(observed, "xyzzy\n[file .*$"));
+ LMI_TEST( lmi_test::whats_what(observed, "xyzzy\n[file .*$"));
// Alternatively, discard any portion of the what-string that
// begins with "\n[file " (presumably appended by LMI_FLUSH) and
// test that truncated what-string. An exact match is accepted:
- BOOST_TEST( lmi_test::whats_what(observed, "xyzzy"));
+ LMI_TEST( lmi_test::whats_what(observed, "xyzzy"));
// However, partial matches are rejected:
- BOOST_TEST(!lmi_test::whats_what(observed, "xyzz"));
- BOOST_TEST(!lmi_test::whats_what(observed, "xyzzy!"));
+ LMI_TEST(!lmi_test::whats_what(observed, "xyzz"));
+ LMI_TEST(!lmi_test::whats_what(observed, "xyzzy!"));
// The expectation must exactly equal either the untruncated or
// the truncated what-string; an exact match to a "partially
// truncated" what-string is rejected:
- BOOST_TEST(!lmi_test::whats_what(observed, "xyzzy\n"));
- BOOST_TEST(!lmi_test::whats_what(observed, "xyzzy\n[file .*"));
+ LMI_TEST(!lmi_test::whats_what(observed, "xyzzy\n"));
+ LMI_TEST(!lmi_test::whats_what(observed, "xyzzy\n[file .*"));
return 0;
}
diff --git a/timer_test.cpp b/timer_test.cpp
index 6ba5fa3..e940d37 100644
--- a/timer_test.cpp
+++ b/timer_test.cpp
@@ -79,27 +79,27 @@ void TimerTest::TestExceptions()
{
Timer timer;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(timer.start()
,std::logic_error
,"Timer::start() called, but timer was already running."
);
timer.stop();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(timer.stop()
,std::logic_error
,"Timer::stop() called, but timer was not running."
);
timer.restart();
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(timer.restart()
,std::logic_error
,"Timer::start() called, but timer was already running."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(timer.elapsed_seconds()
,std::logic_error
,"Timer::elapsed_seconds() called, but timer is still running."
@@ -116,15 +116,15 @@ void TimerTest::TestAliquotTimer()
std::cout << " " << TimeAnAliquot(std::bind(goo, 10, x, x, &x), 0.1) <<
'\n';
std::string takes_too_long = TimeAnAliquot(WaitTenMsec, 0.0099999).str();
- BOOST_TEST(contains(takes_too_long, "took longer"));
+ LMI_TEST(contains(takes_too_long, "took longer"));
std::cout << " " << takes_too_long << '\n';
std::cout << " " << TimeAnAliquot(WaitTenMsec, 0.099) << '\n';
std::cout << " " << TimeAnAliquot(WaitTenMsec, 0.101) << '\n';
- BOOST_TEST_THROW(TimeAnAliquot(WaitTenMsec, 1.0e-100),
std::invalid_argument, "");
- BOOST_TEST_THROW(TimeAnAliquot(WaitTenMsec, 0.0 ),
std::invalid_argument, "");
- BOOST_TEST_THROW(TimeAnAliquot(WaitTenMsec, -1.0 ),
std::invalid_argument, "");
+ LMI_TEST_THROW(TimeAnAliquot(WaitTenMsec, 1.0e-100),
std::invalid_argument, "");
+ LMI_TEST_THROW(TimeAnAliquot(WaitTenMsec, 0.0 ),
std::invalid_argument, "");
+ LMI_TEST_THROW(TimeAnAliquot(WaitTenMsec, -1.0 ),
std::invalid_argument, "");
std::cout << " " << TimeAnAliquot(SleepOneSec, 2.000) << '\n';
}
diff --git a/tn_range_test.cpp b/tn_range_test.cpp
index 2900c9f..c12b9f1 100644
--- a/tn_range_test.cpp
+++ b/tn_range_test.cpp
@@ -137,19 +137,19 @@ void tn_range_test::test_auxiliary_functions(char const*
file, int line)
T const maxT = std::numeric_limits<T>::max();
T const minT = std::numeric_limits<T>::lowest();
- INVOKE_BOOST_TEST(!is_strictly_between_extrema(maxT), file, line);
+ INVOKE_LMI_TEST(!is_strictly_between_extrema(maxT), file, line);
if(!std::is_same_v<bool,typename std::remove_cv<T>::type>)
{
- INVOKE_BOOST_TEST( is_strictly_between_extrema<T>(1), file, line);
+ INVOKE_LMI_TEST( is_strictly_between_extrema<T>(1), file, line);
}
- INVOKE_BOOST_TEST_EQUAL( 0, signum(T( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, signum(T( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL( 0, signum(T( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, signum(T( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, signum(maxT), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, signum(maxT), file, line);
- INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T( 0)), file, line);
- INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T( 1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(true , is_exact_integer(T( 0)), file, line);
+ INVOKE_LMI_TEST_EQUAL(true , is_exact_integer(T( 1)), file, line);
if(minT < 0)
{
@@ -157,9 +157,9 @@ void tn_range_test::test_auxiliary_functions(char const*
file, int line)
// diagnostics. An 'is_bool' conditional wouldn't prevent the
// macros from being expanded. See:
// https://lists.nongnu.org/archive/html/lmi/2017-05/msg00029.html
- INVOKE_BOOST_TEST_EQUAL(T(-1), signum(T(-1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(T(-1), signum(minT ), file, line);
- INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T(-1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(T(-1), signum(T(-1)), file, line);
+ INVOKE_LMI_TEST_EQUAL(T(-1), signum(minT ), file, line);
+ INVOKE_LMI_TEST_EQUAL(true , is_exact_integer(T(-1)), file, line);
}
// Integer types truncate the argument, always resulting in an
@@ -167,8 +167,8 @@ void tn_range_test::test_auxiliary_functions(char const*
file, int line)
bool volatile exact = std::numeric_limits<T>::is_exact;
if(!exact)
{
- INVOKE_BOOST_TEST_EQUAL(false, is_exact_integer(T( 0.5)), file, line);
- INVOKE_BOOST_TEST_EQUAL(false, is_exact_integer(T(1.07)), file, line);
+ INVOKE_LMI_TEST_EQUAL(false, is_exact_integer(T( 0.5)), file, line);
+ INVOKE_LMI_TEST_EQUAL(false, is_exact_integer(T(1.07)), file, line);
}
bool volatile is_iec559 = std::numeric_limits<T>::is_iec559;
@@ -176,29 +176,29 @@ void tn_range_test::test_auxiliary_functions(char const*
file, int line)
if(is_iec559 && has_infinity)
{
T const infT = std::numeric_limits<T>::infinity();
- INVOKE_BOOST_TEST_EQUAL(-1, signum(-infT), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, signum( infT), file, line);
+ INVOKE_LMI_TEST_EQUAL(-1, signum(-infT), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, signum( infT), file, line);
}
bool volatile has_quiet_NaN = std::numeric_limits<T>::has_quiet_NaN;
if(is_iec559 && has_quiet_NaN)
{
T const qnanT = std::numeric_limits<T>::quiet_NaN();
- INVOKE_BOOST_TEST_EQUAL(-1, signum(-qnanT), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, signum( qnanT), file, line);
+ INVOKE_LMI_TEST_EQUAL(-1, signum(-qnanT), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, signum( qnanT), file, line);
}
}
template<typename T>
void tn_range_test::test_floating_auxiliary_functions(char const* file, int
line)
{
- INVOKE_BOOST_TEST_EQUAL(-1, adjust_bound(T(-1),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( 0, adjust_bound(T( 0),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, adjust_bound(T( 1),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL(-1, adjust_bound(T(-1),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( 0, adjust_bound(T( 0),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, adjust_bound(T( 1),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL(-1, adjust_bound(T(-1),
-std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( 0, adjust_bound(T( 0),
-std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, adjust_bound(T( 1),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL(-1, adjust_bound(T(-1),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( 0, adjust_bound(T( 0),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( 1, adjust_bound(T( 1),
-std::numeric_limits<T>::max()), file, line);
bool volatile exact = std::numeric_limits<T>::is_exact;
if(!exact)
@@ -210,19 +210,19 @@ void
tn_range_test::test_floating_auxiliary_functions(char const* file, int line
// Test direction of adjustment.
- INVOKE_BOOST_TEST_RELATION(T(-1.07), <=, adjust_bound(T(-1.07),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T( 1.07), <=, adjust_bound(T( 1.07),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T(-1.07), <=, adjust_bound(T(-1.07),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T( 1.07), <=, adjust_bound(T( 1.07),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T(-1.07), >=, adjust_bound(T(-1.07),
-std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T( 1.07), >=, adjust_bound(T( 1.07),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T(-1.07), >=, adjust_bound(T(-1.07),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T( 1.07), >=, adjust_bound(T( 1.07),
-std::numeric_limits<T>::max()), file, line);
// Test inequality of original and adjusted values.
- INVOKE_BOOST_TEST_RELATION(T(-1.07), <, adjust_bound(T(-1.07),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T( 1.07), <, adjust_bound(T( 1.07),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T(-1.07), <, adjust_bound(T(-1.07),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T( 1.07), <, adjust_bound(T( 1.07),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T(-1.07), >, adjust_bound(T(-1.07),
-std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_RELATION(T( 1.07), >, adjust_bound(T( 1.07),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T(-1.07), >, adjust_bound(T(-1.07),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_RELATION(T( 1.07), >, adjust_bound(T( 1.07),
-std::numeric_limits<T>::max()), file, line);
}
bool volatile is_iec559 = std::numeric_limits<T>::is_iec559;
@@ -230,10 +230,10 @@ void
tn_range_test::test_floating_auxiliary_functions(char const* file, int line
if(is_iec559 && has_infinity)
{
T const infT = std::numeric_limits<T>::infinity();
- INVOKE_BOOST_TEST_EQUAL(-infT, adjust_bound(T(-infT),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( infT, adjust_bound(T( infT),
std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL(-infT, adjust_bound(T(-infT),
-std::numeric_limits<T>::max()), file, line);
- INVOKE_BOOST_TEST_EQUAL( infT, adjust_bound(T( infT),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL(-infT, adjust_bound(T(-infT),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( infT, adjust_bound(T( infT),
std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL(-infT, adjust_bound(T(-infT),
-std::numeric_limits<T>::max()), file, line);
+ INVOKE_LMI_TEST_EQUAL( infT, adjust_bound(T( infT),
-std::numeric_limits<T>::max()), file, line);
}
}
@@ -250,50 +250,50 @@ void tn_range_test::test_percentages(char const* file,
int line)
T t_percentage;
t_percentage = 50;
- INVOKE_BOOST_TEST_EQUAL(N(50), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N(50), t_percentage, file, line);
- INVOKE_BOOST_TEST(!t_percentage.is_valid( n1), file, line);
- INVOKE_BOOST_TEST( t_percentage.is_valid( 0), file, line);
- INVOKE_BOOST_TEST( t_percentage.is_valid( 1), file, line);
- INVOKE_BOOST_TEST( t_percentage.is_valid(100), file, line);
- INVOKE_BOOST_TEST(!t_percentage.is_valid(101), file, line);
+ INVOKE_LMI_TEST(!t_percentage.is_valid( n1), file, line);
+ INVOKE_LMI_TEST( t_percentage.is_valid( 0), file, line);
+ INVOKE_LMI_TEST( t_percentage.is_valid( 1), file, line);
+ INVOKE_LMI_TEST( t_percentage.is_valid(100), file, line);
+ INVOKE_LMI_TEST(!t_percentage.is_valid(101), file, line);
- INVOKE_BOOST_TEST(!t_percentage.diagnose_invalidity(" -1").empty(), file,
line);
- INVOKE_BOOST_TEST( t_percentage.diagnose_invalidity(" 0").empty(), file,
line);
- INVOKE_BOOST_TEST( t_percentage.diagnose_invalidity(" 1").empty(), file,
line);
- INVOKE_BOOST_TEST( t_percentage.diagnose_invalidity("100").empty(), file,
line);
- INVOKE_BOOST_TEST(!t_percentage.diagnose_invalidity("101").empty(), file,
line);
+ INVOKE_LMI_TEST(!t_percentage.diagnose_invalidity(" -1").empty(), file,
line);
+ INVOKE_LMI_TEST( t_percentage.diagnose_invalidity(" 0").empty(), file,
line);
+ INVOKE_LMI_TEST( t_percentage.diagnose_invalidity(" 1").empty(), file,
line);
+ INVOKE_LMI_TEST( t_percentage.diagnose_invalidity("100").empty(), file,
line);
+ INVOKE_LMI_TEST(!t_percentage.diagnose_invalidity("101").empty(), file,
line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.minimum(), 0, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.maximum(), 100, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.minimum(), 0, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.maximum(), 100, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.curb(n10), 0, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.curb( 0), 0, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.curb( 1), 1, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.curb(100), 100, file, line);
- INVOKE_BOOST_TEST_EQUAL(t_percentage.curb(101), 100, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.curb(n10), 0, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.curb( 0), 0, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.curb( 1), 1, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.curb(100), 100, file, line);
+ INVOKE_LMI_TEST_EQUAL(t_percentage.curb(101), 100, file, line);
T t0(n10);
- INVOKE_BOOST_TEST_EQUAL(N( 0), t0, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 0), t0, file, line);
T t1( 0);
- INVOKE_BOOST_TEST_EQUAL(N( 0), t1, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 0), t1, file, line);
T t2( 1);
- INVOKE_BOOST_TEST_EQUAL(N( 1), t2, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 1), t2, file, line);
T t3(100);
- INVOKE_BOOST_TEST_EQUAL(N(100), t3, file, line);
+ INVOKE_LMI_TEST_EQUAL(N(100), t3, file, line);
T t4(101);
- INVOKE_BOOST_TEST_EQUAL(N(100), t4, file, line);
+ INVOKE_LMI_TEST_EQUAL(N(100), t4, file, line);
t_percentage = n10;
- INVOKE_BOOST_TEST_EQUAL(N( 0), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 0), t_percentage, file, line);
t_percentage = 0;
- INVOKE_BOOST_TEST_EQUAL(N( 0), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 0), t_percentage, file, line);
t_percentage = 1;
- INVOKE_BOOST_TEST_EQUAL(N( 1), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N( 1), t_percentage, file, line);
t_percentage = 100;
- INVOKE_BOOST_TEST_EQUAL(N(100), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N(100), t_percentage, file, line);
t_percentage = 101;
- INVOKE_BOOST_TEST_EQUAL(N(100), t_percentage, file, line);
+ INVOKE_LMI_TEST_EQUAL(N(100), t_percentage, file, line);
}
void tn_range_test::test()
@@ -322,99 +322,99 @@ void tn_range_test::test()
// Default ctor.
r_nonnegative range0;
- BOOST_TEST_EQUAL(range0, r_one);
+ LMI_TEST_EQUAL(range0, r_one);
// Copy ctor.
r_nonnegative range1(range0);
- BOOST_TEST_EQUAL(range1, r_one);
+ LMI_TEST_EQUAL(range1, r_one);
// Construct from Number.
r_nonnegative range2(3.14159);
- BOOST_TEST_EQUAL(range2, r_pi);
+ LMI_TEST_EQUAL(range2, r_pi);
// Construct from std::string.
r_nonnegative range3(s_e);
- BOOST_TEST_EQUAL(range3, r_e);
+ LMI_TEST_EQUAL(range3, r_e);
// Construct from char const* implicitly converted to std::string.
r_nonnegative range4("2.71828");
- BOOST_TEST_EQUAL(range4, r_e);
+ LMI_TEST_EQUAL(range4, r_e);
// *** Assignment.
// Copy assignment operator.
range1 = range3;
- BOOST_TEST_EQUAL(range1, r_e);
+ LMI_TEST_EQUAL(range1, r_e);
// Assign from Number.
range1 = 0.0;
- BOOST_TEST_EQUAL(range1, r_zero);
+ LMI_TEST_EQUAL(range1, r_zero);
// Assign from std::string.
range1 = s_e;
- BOOST_TEST_EQUAL(range1, r_e);
+ LMI_TEST_EQUAL(range1, r_e);
// Assign from char const* implicitly converted to std::string.
range1 = "3.14159";
- BOOST_TEST_EQUAL(range1, r_pi);
+ LMI_TEST_EQUAL(range1, r_pi);
// *** Equivalence.
// Equivalence to same type.
- BOOST_TEST_EQUAL(range1, range2);
+ LMI_TEST_EQUAL(range1, range2);
// Equivalence to Number.
- BOOST_TEST_EQUAL(range1, 3.14159);
+ LMI_TEST_EQUAL(range1, 3.14159);
// Equivalence to std::string.
- BOOST_TEST_EQUAL(range1, s_pi);
+ LMI_TEST_EQUAL(range1, s_pi);
// Equivalence to char const* implicitly converted to std::string.
- BOOST_TEST_EQUAL(range1, "3.14159");
+ LMI_TEST_EQUAL(range1, "3.14159");
// Because comparison to std::string is a matter of numerical
// equivalence, test several equivalent representations.
- BOOST_TEST_EQUAL(range1, "3.1415900");
- BOOST_TEST_EQUAL(range1, "3.14159e0");
- BOOST_TEST_EQUAL(range1, ".314159E1");
+ LMI_TEST_EQUAL(range1, "3.1415900");
+ LMI_TEST_EQUAL(range1, "3.14159e0");
+ LMI_TEST_EQUAL(range1, ".314159E1");
// *** Operators added by boost::equality_comparable.
// Inequivalence to same type.
- BOOST_TEST_UNEQUAL(range4, range1);
+ LMI_TEST_UNEQUAL(range4, range1);
// [In]equivalence to Number.
- BOOST_TEST_EQUAL (3.14159, range1);
- BOOST_TEST_UNEQUAL(range1, 2.71828);
- BOOST_TEST_UNEQUAL(2.71828, range1);
+ LMI_TEST_EQUAL (3.14159, range1);
+ LMI_TEST_UNEQUAL(range1, 2.71828);
+ LMI_TEST_UNEQUAL(2.71828, range1);
// [In]equivalence to std::string.
- BOOST_TEST_EQUAL (s_pi, range1);
- BOOST_TEST_UNEQUAL(range1, s_e);
- BOOST_TEST_UNEQUAL(s_e, range1);
+ LMI_TEST_EQUAL (s_pi, range1);
+ LMI_TEST_UNEQUAL(range1, s_e);
+ LMI_TEST_UNEQUAL(s_e, range1);
// *** Explicit conversions.
// Explicit conversion to std::string.
- BOOST_TEST_EQUAL(range1.str(), "3.14159");
+ LMI_TEST_EQUAL(range1.str(), "3.14159");
// Explicit conversion to number.
- BOOST_TEST_EQUAL(range1.value(), 3.14159);
+ LMI_TEST_EQUAL(range1.value(), 3.14159);
// *** Type identification.
- BOOST_TEST(typeid(double) == range1.value_type());
+ LMI_TEST(typeid(double) == range1.value_type());
// *** Limits.
// Floating-point limits having an exact binary representation.
- BOOST_TEST_EQUAL(range1.minimum(), 0.0);
- BOOST_TEST_EQUAL(range1.maximum(), std::numeric_limits<double>::max());
- BOOST_TEST( range1.is_valid( 1.0));
- BOOST_TEST( range1.is_valid( 0.0));
- BOOST_TEST( range1.is_valid(-0.0));
- BOOST_TEST(!range1.is_valid(-1.0));
- BOOST_TEST_EQUAL(range1.curb( -1.0), 0.0);
+ LMI_TEST_EQUAL(range1.minimum(), 0.0);
+ LMI_TEST_EQUAL(range1.maximum(), std::numeric_limits<double>::max());
+ LMI_TEST( range1.is_valid( 1.0));
+ LMI_TEST( range1.is_valid( 0.0));
+ LMI_TEST( range1.is_valid(-0.0));
+ LMI_TEST(!range1.is_valid(-1.0));
+ LMI_TEST_EQUAL(range1.curb( -1.0), 0.0);
// Floating-point limits having no exact binary representation.
@@ -436,53 +436,53 @@ void tn_range_test::test()
double volatile hi = 0.070000000000000001;
double volatile lo = 0.069999999999999999;
double volatile z = lo * (1.0 + epsilon);
- BOOST_TEST(z == hi);
+ LMI_TEST(z == hi);
r_surd surd0;
- BOOST_TEST(!surd0.is_valid( 0.0699999999999999 ));
- BOOST_TEST( surd0.is_valid( 0.069999999999999999));
- BOOST_TEST( surd0.is_valid( 0.070000000000000000));
- BOOST_TEST( surd0.is_valid( 0.070000000000000001));
- BOOST_TEST(!surd0.is_valid( 0.0700000000000001 ));
+ LMI_TEST(!surd0.is_valid( 0.0699999999999999 ));
+ LMI_TEST( surd0.is_valid( 0.069999999999999999));
+ LMI_TEST( surd0.is_valid( 0.070000000000000000));
+ LMI_TEST( surd0.is_valid( 0.070000000000000001));
+ LMI_TEST(!surd0.is_valid( 0.0700000000000001 ));
- BOOST_TEST( surd0.is_valid( 0.0700000000000000205391)); // 0.07 * (1+ε)
- BOOST_TEST( surd0.is_valid( 0.0699999999999999927836)); // 0.07 / (1+ε)
+ LMI_TEST( surd0.is_valid( 0.0700000000000000205391)); // 0.07 * (1+ε)
+ LMI_TEST( surd0.is_valid( 0.0699999999999999927836)); // 0.07 / (1+ε)
// If exactly four values are permissible, then exactly one of
// these is permissible.
- BOOST_TEST
+ LMI_TEST
( surd0.is_valid( 0.0700000000000000344169) // 0.07 * (1+2ε)
^ surd0.is_valid( 0.0699999999999999789058) // 0.07 / (1+2ε)
);
- BOOST_TEST(!surd0.is_valid( 0.07 * (1.0 + 3.0 * epsilon)));
- BOOST_TEST(!surd0.is_valid( 0.07 / (1.0 + 3.0 * epsilon)));
+ LMI_TEST(!surd0.is_valid( 0.07 * (1.0 + 3.0 * epsilon)));
+ LMI_TEST(!surd0.is_valid( 0.07 / (1.0 + 3.0 * epsilon)));
// Validation of strings representing floating-point values.
- BOOST_TEST( range1.diagnose_invalidity("-0.0").empty());
- BOOST_TEST( range1.diagnose_invalidity(" -0.").empty());
- BOOST_TEST( range1.diagnose_invalidity(" -.0").empty());
- BOOST_TEST( range1.diagnose_invalidity("-0e0").empty());
- BOOST_TEST( range1.diagnose_invalidity("-0E0").empty());
- BOOST_TEST(!range1.diagnose_invalidity("$123").empty());
+ LMI_TEST( range1.diagnose_invalidity("-0.0").empty());
+ LMI_TEST( range1.diagnose_invalidity(" -0.").empty());
+ LMI_TEST( range1.diagnose_invalidity(" -.0").empty());
+ LMI_TEST( range1.diagnose_invalidity("-0e0").empty());
+ LMI_TEST( range1.diagnose_invalidity("-0E0").empty());
+ LMI_TEST(!range1.diagnose_invalidity("$123").empty());
// *** Stream operators.
r_nonnegative const pi(r_pi);
r_nonnegative range5;
- BOOST_TEST_UNEQUAL(pi, range5);
+ LMI_TEST_UNEQUAL(pi, range5);
std::stringstream ss;
ss << pi;
ss >> range5;
- BOOST_TEST_EQUAL(pi, range5);
+ LMI_TEST_EQUAL(pi, range5);
- BOOST_TEST_UNEQUAL(r_e, range5);
+ LMI_TEST_UNEQUAL(r_e, range5);
ss.str("");
ss.clear();
ss << r_e;
ss >> range5;
- BOOST_TEST_EQUAL(r_e, range5);
+ LMI_TEST_EQUAL(r_e, range5);
// Test a numeric-range class instantiated in a different
// translation unit.
@@ -518,33 +518,33 @@ void tn_range_test::test_diagnostics()
r.maximum( 1.07);
v = r.diagnose_invalidity(" 0.0");
- BOOST_TEST_EQUAL("", v);
+ LMI_TEST_EQUAL("", v);
v = r.diagnose_invalidity(" 1.07");
- BOOST_TEST_EQUAL("", v);
+ LMI_TEST_EQUAL("", v);
v = r.diagnose_invalidity("-1.07");
- BOOST_TEST_EQUAL("", v);
+ LMI_TEST_EQUAL("", v);
v = r.diagnose_invalidity(" 1.070000000000001");
s = " 1.070000000000001 is too high: value must be between -1.07 and 1.07
inclusive.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity("-1.070000000000001");
s = "-1.070000000000001 is too low: value must be between -1.07 and 1.07
inclusive.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity(" 1e999999");
s = " 1e999999 is not normalized.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity("-1e999999");
s = "-1e999999 is not normalized.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity("$123");
s = "'$123' is ill formed.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
// Test range [2.0, DBL_MAX]. Changing first the minimum and then
// the maximum would not work: the new minimum of 2.0 exceeds the
@@ -555,15 +555,15 @@ void tn_range_test::test_diagnostics()
v = r.diagnose_invalidity(" 1.07");
s = " 1.07 is too low: 2 is the lower limit.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity("-1e999999");
s = "-1e999999 is not normalized.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
v = r.diagnose_invalidity("1e999999");
s = "1e999999 is not normalized.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
// Test range [-DBL_MAX, 2.0].
@@ -572,7 +572,7 @@ void tn_range_test::test_diagnostics()
v = r.diagnose_invalidity(" 2.718281828");
s = " 2.718281828 is too high: 2 is the upper limit.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
// Test range [-DBL_MAX, DBL_MAX].
@@ -581,20 +581,20 @@ void tn_range_test::test_diagnostics()
v = r.diagnose_invalidity("1e999999");
s = "1e999999 is not normalized.";
- BOOST_TEST_EQUAL(s, v);
+ LMI_TEST_EQUAL(s, v);
}
void tn_range_test::test_absurd_limits()
{
absurd<int> a;
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(a.assert_sanity()
,std::runtime_error
,"Lower bound 1 exceeds upper bound 0 ."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(r_absurd b;
,std::runtime_error
,"Lower bound 1 exceeds upper bound 0 ."
@@ -606,28 +606,28 @@ void tn_range_test::test_absurd_limits()
p0.minimum(1.0);
p0.maximum(2.0);
- BOOST_TEST_EQUAL(p0.minimum(), 1.0);
- BOOST_TEST_EQUAL(p0.maximum(), 2.0);
+ LMI_TEST_EQUAL(p0.minimum(), 1.0);
+ LMI_TEST_EQUAL(p0.maximum(), 2.0);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p0.minimum(-1.0)
,std::runtime_error
,"Cannot change lower bound to -1, which is less than infimum 0 ."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p0.minimum(3.0)
,std::runtime_error
,"Cannot change lower bound to 3, which is greater than upper bound 2
."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p0.maximum(0.0)
,std::runtime_error
,"Cannot change upper bound to 0, which is less than lower bound 1 ."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(p0.maximum(101.0)
,std::runtime_error
,"Cannot change upper bound to 101, which is greater than supremum 100
."
@@ -635,8 +635,8 @@ void tn_range_test::test_absurd_limits()
// Make sure p1's limits aren't affected by the change in p0's.
- BOOST_TEST_EQUAL(p1.minimum(), 0.0);
- BOOST_TEST_EQUAL(p1.maximum(), 100.0);
+ LMI_TEST_EQUAL(p1.minimum(), 0.0);
+ LMI_TEST_EQUAL(p1.maximum(), 100.0);
}
void tn_range_test::test_nonfundamental_number_type()
diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 7cbba75..c18ab4c 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -59,20 +59,20 @@ int test_main(int, char*[])
// These could be static assertions, but any failure would prevent
// other tests from running.
- BOOST_TEST( is_string_v<char *>);
- BOOST_TEST( is_string_v<char const *>);
- BOOST_TEST(!is_string_v<char volatile*>);
- BOOST_TEST(!is_string_v<char const volatile*>);
+ LMI_TEST( is_string_v<char *>);
+ LMI_TEST( is_string_v<char const *>);
+ LMI_TEST(!is_string_v<char volatile*>);
+ LMI_TEST(!is_string_v<char const volatile*>);
- BOOST_TEST( is_string_v<std::string >);
- BOOST_TEST( is_string_v<std::string const >);
- BOOST_TEST(!is_string_v<std::string volatile >);
- BOOST_TEST(!is_string_v<std::string const volatile >);
+ LMI_TEST( is_string_v<std::string >);
+ LMI_TEST( is_string_v<std::string const >);
+ LMI_TEST(!is_string_v<std::string volatile >);
+ LMI_TEST(!is_string_v<std::string const volatile >);
- BOOST_TEST( is_string_v<std::string &>);
- BOOST_TEST( is_string_v<std::string const &>);
- BOOST_TEST(!is_string_v<std::string volatile&>);
- BOOST_TEST(!is_string_v<std::string const volatile&>);
+ LMI_TEST( is_string_v<std::string &>);
+ LMI_TEST( is_string_v<std::string const &>);
+ LMI_TEST(!is_string_v<std::string volatile&>);
+ LMI_TEST(!is_string_v<std::string const volatile&>);
char const* ccp = "2.71828";
char* cp = const_cast<char*>("3.14159");
@@ -84,44 +84,44 @@ int test_main(int, char*[])
// Test which conversion is used for type double.
- BOOST_TEST_EQUAL(e_both_numeric ,method(d ,d ));
- BOOST_TEST_EQUAL(e_both_numeric ,method(d ,i ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(d ,s ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(d ,cp ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(d ,ccp));
- BOOST_TEST_EQUAL(e_stream ,method(d ,x ));
+ LMI_TEST_EQUAL(e_both_numeric ,method(d ,d ));
+ LMI_TEST_EQUAL(e_both_numeric ,method(d ,i ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(d ,s ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(d ,cp ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(d ,ccp));
+ LMI_TEST_EQUAL(e_stream ,method(d ,x ));
- BOOST_TEST_EQUAL(e_both_numeric ,method(d ,d ));
- BOOST_TEST_EQUAL(e_both_numeric ,method(i ,d ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(s ,d ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(cp ,d ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(ccp ,d ));
- BOOST_TEST_EQUAL(e_stream ,method(x ,d ));
+ LMI_TEST_EQUAL(e_both_numeric ,method(d ,d ));
+ LMI_TEST_EQUAL(e_both_numeric ,method(i ,d ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(s ,d ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(cp ,d ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(ccp ,d ));
+ LMI_TEST_EQUAL(e_stream ,method(x ,d ));
// Test which conversion is used for type std::string.
- BOOST_TEST_EQUAL(e_numeric_io ,method(s ,d ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(s ,i ));
- BOOST_TEST_EQUAL(e_direct ,method(s ,s ));
- BOOST_TEST_EQUAL(e_stream ,method(s ,ccp));
- BOOST_TEST_EQUAL(e_stream ,method(s ,x ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(s ,d ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(s ,i ));
+ LMI_TEST_EQUAL(e_direct ,method(s ,s ));
+ LMI_TEST_EQUAL(e_stream ,method(s ,ccp));
+ LMI_TEST_EQUAL(e_stream ,method(s ,x ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(d ,s ));
- BOOST_TEST_EQUAL(e_numeric_io ,method(i ,s ));
- BOOST_TEST_EQUAL(e_direct ,method(s ,s ));
- BOOST_TEST_EQUAL(e_direct ,method(ccp ,s ));
- BOOST_TEST_EQUAL(e_stream ,method(x ,s ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(d ,s ));
+ LMI_TEST_EQUAL(e_numeric_io ,method(i ,s ));
+ LMI_TEST_EQUAL(e_direct ,method(s ,s ));
+ LMI_TEST_EQUAL(e_direct ,method(ccp ,s ));
+ LMI_TEST_EQUAL(e_stream ,method(x ,s ));
// Not convertible: stream_cast() forbids conversion to pointer.
- BOOST_TEST_EQUAL(e_stream ,method(ccp ,cp ));
+ LMI_TEST_EQUAL(e_stream ,method(ccp ,cp ));
// Not convertible: value_cast() forbids conversion to pointer.
- BOOST_TEST_EQUAL(e_direct ,method(cp ,ccp));
+ LMI_TEST_EQUAL(e_direct ,method(cp ,ccp));
// Not convertible: value_cast() forbids conversion to pointer.
- BOOST_TEST_EQUAL(e_stream ,method(s, static_cast<char
volatile*>(nullptr) ));
+ LMI_TEST_EQUAL(e_stream ,method(s, static_cast<char
volatile*>(nullptr) ));
- BOOST_TEST_EQUAL(e_stream ,method( static_cast<char
volatile*>(nullptr), s));
+ LMI_TEST_EQUAL(e_stream ,method( static_cast<char
volatile*>(nullptr), s));
ndc = value_cast<NotDefaultConstructible>(ndc);
ndc = value_cast(ndc, ndc);
@@ -132,14 +132,14 @@ int test_main(int, char*[])
// ccp = value_cast(cp, ccp);
x = value_cast(s, x);
- BOOST_TEST_EQUAL(x.s, "test");
+ LMI_TEST_EQUAL(x.s, "test");
d = value_cast(ccp, d);
- BOOST_TEST_EQUAL(d, 2.71828);
+ LMI_TEST_EQUAL(d, 2.71828);
// Forbidden narrowing conversions.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<unsigned int>(-1)
,std::runtime_error
,"Cannot cast negative to unsigned."
@@ -147,12 +147,12 @@ int test_main(int, char*[])
// Forbidden truncation.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(i = value_cast<int>(d)
,std::runtime_error
,lmi_test::what_regex("^Cast.*would not preserve value\\.$")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(bourn_cast<int>(2.71828)
,std::runtime_error
,lmi_test::what_regex("^Cast.*would not preserve value\\.$")
@@ -161,26 +161,26 @@ int test_main(int, char*[])
// This conversion should work: value is exactly preserved.
i = value_cast<int>(2.0);
- BOOST_TEST_EQUAL(i, 2);
+ LMI_TEST_EQUAL(i, 2);
d = value_cast(i, d);
- BOOST_TEST_EQUAL(d, 2.0);
+ LMI_TEST_EQUAL(d, 2.0);
s = value_cast<std::string>(2.0 / 3.0);
- BOOST_TEST_EQUAL(s, "0.666666666666667");
+ LMI_TEST_EQUAL(s, "0.666666666666667");
d = value_cast<double>(s);
- BOOST_TEST_EQUAL(s, value_cast<std::string>(d));
+ LMI_TEST_EQUAL(s, value_cast<std::string>(d));
d = value_cast<double>("123.456");
- BOOST_TEST_EQUAL(d, 123.456);
+ LMI_TEST_EQUAL(d, 123.456);
std::string t("This is a test.");
- BOOST_TEST_EQUAL(t, value_cast<std::string>(t));
+ LMI_TEST_EQUAL(t, value_cast<std::string>(t));
- BOOST_TEST_EQUAL(0, extra_tests0());
- BOOST_TEST_EQUAL(0, extra_tests1());
- BOOST_TEST_EQUAL(0, boost_tests());
+ LMI_TEST_EQUAL(0, extra_tests0());
+ LMI_TEST_EQUAL(0, extra_tests1());
+ LMI_TEST_EQUAL(0, boost_tests());
return 0;
}
@@ -195,47 +195,47 @@ std::string strip(std::string numeric_string)
int extra_tests0()
{
char const* p = "31";
- BOOST_TEST_EQUAL(31, value_cast<int >(p));
- BOOST_TEST_EQUAL(31, value_cast<double>(p));
+ LMI_TEST_EQUAL(31, value_cast<int >(p));
+ LMI_TEST_EQUAL(31, value_cast<double>(p));
char q[0x0100];
std::strcpy(q, value_cast<std::string>(0).c_str());
- BOOST_TEST_EQUAL(0, std::strcmp(q, "0"));
+ LMI_TEST_EQUAL(0, std::strcmp(q, "0"));
int i = 0;
std::strcpy(q, value_cast<std::string>(i).c_str());
- BOOST_TEST_EQUAL(0, std::strcmp(q, "0"));
+ LMI_TEST_EQUAL(0, std::strcmp(q, "0"));
std::strcpy(q, value_cast<std::string>(31.0).c_str());
- BOOST_TEST_EQUAL(0, std::strcmp(q, "31"));
+ LMI_TEST_EQUAL(0, std::strcmp(q, "31"));
- BOOST_TEST_EQUAL("31" , value_cast<std::string>(31));
- BOOST_TEST_EQUAL("310", value_cast<std::string>(310));
- BOOST_TEST_EQUAL("31" , value_cast<std::string>(31.0));
- BOOST_TEST_EQUAL("310", value_cast<std::string>(310.0));
- BOOST_TEST_EQUAL("0" , value_cast<std::string>(.0));
+ LMI_TEST_EQUAL("31" , value_cast<std::string>(31));
+ LMI_TEST_EQUAL("310", value_cast<std::string>(310));
+ LMI_TEST_EQUAL("31" , value_cast<std::string>(31.0));
+ LMI_TEST_EQUAL("310", value_cast<std::string>(310.0));
+ LMI_TEST_EQUAL("0" , value_cast<std::string>(.0));
double d;
d = 130000000000000.0;
- BOOST_TEST_EQUAL( "130000000000000", value_cast<std::string>(d));
+ LMI_TEST_EQUAL( "130000000000000", value_cast<std::string>(d));
d = 1300000000000000.0;
- BOOST_TEST_EQUAL("1300000000000000", value_cast<std::string>(d));
-
- BOOST_TEST_EQUAL("1233" , strip("1233"));
- BOOST_TEST_EQUAL("1230" , strip("1230"));
- BOOST_TEST_EQUAL("1230" , strip("1230."));
- BOOST_TEST_EQUAL("1230" , strip("1230.0"));
- BOOST_TEST_EQUAL("123" , strip("123.0"));
- BOOST_TEST_EQUAL("123.3" , strip("123.30"));
- BOOST_TEST_EQUAL("123.3" , strip("123.3"));
- BOOST_TEST_EQUAL("1.233" , strip("1.233"));
- BOOST_TEST_EQUAL("0.1233", strip(".1233"));
- BOOST_TEST_EQUAL("0.1233", strip("0.1233"));
- BOOST_TEST_EQUAL("0.1233", strip("0.123300"));
-
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL("1300000000000000", value_cast<std::string>(d));
+
+ LMI_TEST_EQUAL("1233" , strip("1233"));
+ LMI_TEST_EQUAL("1230" , strip("1230"));
+ LMI_TEST_EQUAL("1230" , strip("1230."));
+ LMI_TEST_EQUAL("1230" , strip("1230.0"));
+ LMI_TEST_EQUAL("123" , strip("123.0"));
+ LMI_TEST_EQUAL("123.3" , strip("123.30"));
+ LMI_TEST_EQUAL("123.3" , strip("123.3"));
+ LMI_TEST_EQUAL("1.233" , strip("1.233"));
+ LMI_TEST_EQUAL("0.1233", strip(".1233"));
+ LMI_TEST_EQUAL("0.1233", strip("0.1233"));
+ LMI_TEST_EQUAL("0.1233", strip("0.123300"));
+
+ LMI_TEST_EQUAL
( "0.000000000000000000001233"
,strip("0.000000000000000000001233")
);
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
( "0.000000000000000000001233"
,strip( ".00000000000000000000123300000000")
);
@@ -245,15 +245,15 @@ int extra_tests0()
char rendptr[100] = {'\0'};
char* endptr = rendptr;
std::strtod(nptr, &endptr);
- BOOST_TEST_EQUAL('\0', *endptr);
- BOOST_TEST_UNEQUAL(nptr, endptr);
+ LMI_TEST_EQUAL('\0', *endptr);
+ LMI_TEST_UNEQUAL(nptr, endptr);
}
- BOOST_TEST_EQUAL("0", strip("00." ));
- BOOST_TEST_EQUAL("0", strip( "0." ));
- BOOST_TEST_EQUAL("0", strip( ".0" ));
- BOOST_TEST_EQUAL("0", strip( "0.0" ));
- BOOST_TEST_EQUAL("0", strip("00.00"));
+ LMI_TEST_EQUAL("0", strip("00." ));
+ LMI_TEST_EQUAL("0", strip( "0." ));
+ LMI_TEST_EQUAL("0", strip( ".0" ));
+ LMI_TEST_EQUAL("0", strip( "0.0" ));
+ LMI_TEST_EQUAL("0", strip("00.00"));
std::string a("1.2");
std::string b("3.4 777");
@@ -261,55 +261,55 @@ int extra_tests0()
d = 3.14159;
a = value_cast<std::string>(b);
- BOOST_TEST_EQUAL("3.4 777", a);
+ LMI_TEST_EQUAL("3.4 777", a);
a = value_cast<std::string>(d);
- BOOST_TEST_EQUAL("3.14159", a);
+ LMI_TEST_EQUAL("3.14159", a);
- BOOST_TEST_THROW(value_cast<double>(b) , std::invalid_argument, "");
- BOOST_TEST_THROW(value_cast<double>(""), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<double>(b) , std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<double>(""), std::invalid_argument, "");
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<std::string>(static_cast<char*>(nullptr))
,std::runtime_error
,"Null pointer holds no value to convert."
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<std::string>(static_cast<char const*>(nullptr))
,std::runtime_error
,"Null pointer holds no value to convert."
);
- BOOST_TEST_EQUAL("0", value_cast<std::string>(static_cast<char
volatile*>(nullptr)));
- BOOST_TEST_EQUAL("0", value_cast<std::string>(static_cast<char const
volatile*>(nullptr)));
+ LMI_TEST_EQUAL("0", value_cast<std::string>(static_cast<char
volatile*>(nullptr)));
+ LMI_TEST_EQUAL("0", value_cast<std::string>(static_cast<char const
volatile*>(nullptr)));
// Numeric casts from
// (char *)(0)
// (char volatile*)(0)
// (char const volatile*)(0)
// are forbidden by a compile-time assertion.
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<unsigned int>(static_cast<char const*>(nullptr))
,std::runtime_error
,"Cannot convert (char const*)(0) to number."
);
d = value_cast<double>(a);
- BOOST_TEST_EQUAL(3.14159, d);
+ LMI_TEST_EQUAL(3.14159, d);
a = value_cast<std::string>(d);
- BOOST_TEST_EQUAL("3.14159", a);
+ LMI_TEST_EQUAL("3.14159", a);
a = value_cast<std::string>(c);
- BOOST_TEST_EQUAL("This is a test.", a);
+ LMI_TEST_EQUAL("This is a test.", a);
b = value_cast<std::string>(a);
- BOOST_TEST_EQUAL("This is a test.", b);
+ LMI_TEST_EQUAL("This is a test.", b);
d = 1e+161;
a = value_cast<std::string>(d);
- BOOST_TEST_EQUAL(d, value_cast<double>(a));
+ LMI_TEST_EQUAL(d, value_cast<double>(a));
std::string e
("1"
@@ -320,13 +320,13 @@ int extra_tests0()
);
// https://lists.nongnu.org/archive/html/lmi/2010-04/msg00042.html
int const number_of_digits = 16;
- BOOST_TEST(0 == e.compare(0, number_of_digits, a, 0, number_of_digits));
+ LMI_TEST(0 == e.compare(0, number_of_digits, a, 0, number_of_digits));
// An empty string should be convertible to string without error.
std::string s;
- BOOST_TEST(value_cast<std::string>(s).empty());
+ LMI_TEST(value_cast<std::string>(s).empty());
std::string const& s_const_ref(s);
- BOOST_TEST(value_cast<std::string>(s_const_ref).empty());
+ LMI_TEST(value_cast<std::string>(s_const_ref).empty());
// A big number that must be representable as a finite
// floating-point number [18.2.1.2/27].
@@ -338,8 +338,8 @@ int extra_tests0()
// Using libmingwex's strtod() to convert a really big number
// fails with mpatrol. This test is retained in case another
// implementation suffers from the same problem.
- BOOST_TEST_EQUAL( big, value_cast<double>(value_cast<std::string>( big)));
- BOOST_TEST_EQUAL(-big, value_cast<double>(value_cast<std::string>(-big)));
+ LMI_TEST_EQUAL( big, value_cast<double>(value_cast<std::string>( big)));
+ LMI_TEST_EQUAL(-big, value_cast<double>(value_cast<std::string>(-big)));
// This minimal, self-contained testcase produces an
// "ILLMEM" error with mpatrol when built with MinGW gcc-3.4.5 and
// 'mingwrt-3.15.2-mingw32-dev.tar.gz'. The value of 'nptr' is the
@@ -371,17 +371,17 @@ int extra_tests0()
(1.0
,std::numeric_limits<double>::min_exponent
);
- BOOST_TEST_EQUAL( small, value_cast<double>(value_cast<std::string>(
small)));
- BOOST_TEST_EQUAL(-small,
value_cast<double>(value_cast<std::string>(-small)));
+ LMI_TEST_EQUAL( small, value_cast<double>(value_cast<std::string>(
small)));
+ LMI_TEST_EQUAL(-small,
value_cast<double>(value_cast<std::string>(-small)));
// Of course, the minimum normalized power of two is this:
double tiny = std::scalbn
(1.0
,std::numeric_limits<double>::min_exponent - 1
);
- BOOST_TEST_EQUAL(0x1p-1022, tiny);
+ LMI_TEST_EQUAL(0x1p-1022, tiny);
// which converts to this:
- BOOST_TEST_EQUAL(0x0.fffffffffffffp-1022,
value_cast<double>(value_cast<std::string>(tiny)));
+ LMI_TEST_EQUAL(0x0.fffffffffffffp-1022,
value_cast<double>(value_cast<std::string>(tiny)));
// which is the largest denormal.
//
// The round trip works for the values tested earlier only by
@@ -400,30 +400,30 @@ int extra_tests1()
{
// A char is treated as an arithmetic type, not as an element of a
// string literal: here, stream_cast() behaves differently.
- BOOST_TEST_UNEQUAL(" ", value_cast<std::string>(' '));
+ LMI_TEST_UNEQUAL(" ", value_cast<std::string>(' '));
std::string s;
bool b0 = true;
s = value_cast<std::string>(b0);
- BOOST_TEST_EQUAL("1", s);
+ LMI_TEST_EQUAL("1", s);
bool const b1 = false;
s = value_cast(b1, s);
- BOOST_TEST_EQUAL("0", s);
+ LMI_TEST_EQUAL("0", s);
int i0 = 1234;
s = value_cast<std::string>(i0);
- BOOST_TEST_EQUAL("1234", s);
+ LMI_TEST_EQUAL("1234", s);
int const i1 = -4321;
s = value_cast(i1, s);
- BOOST_TEST_EQUAL("-4321", s);
+ LMI_TEST_EQUAL("-4321", s);
double d0 = 1.5;
s = value_cast<std::string>(d0);
- BOOST_TEST_EQUAL("1.5", s);
+ LMI_TEST_EQUAL("1.5", s);
double const d1 = -2.5;
s = value_cast(d1, s);
- BOOST_TEST_EQUAL("-2.5", s);
+ LMI_TEST_EQUAL("-2.5", s);
return 0;
}
@@ -458,15 +458,15 @@ int extra_tests1()
/// treatment of char types. See the explanation and rationale in the
/// accompanying header. The boost::lexical_cast tests below have been
/// changed to reflect this difference. For instance, original test
-/// BOOST_TEST_EQUAL('1', boost::lexical_cast<char>(1));
+/// LMI_TEST_EQUAL('1', boost::lexical_cast<char>(1));
/// is replaced by
-/// BOOST_TEST_EQUAL('\1', value_cast<char>(1));
+/// LMI_TEST_EQUAL('\1', value_cast<char>(1));
/// which asserts the correct postcondition for value_cast.
///
/// Important note on narrowing conversions.
///
/// Some of the boost tests involve narrowing conversions, e.g.:
-/// BOOST_TEST_EQUAL('1', value_cast<char>(1.0));
+/// LMI_TEST_EQUAL('1', value_cast<char>(1.0));
/// With value_cast(), some compilers give a warning about these
/// tests, as is proper. Such tests are suppressed here in order
/// order to get a clean compile.
@@ -488,39 +488,39 @@ int boost_tests()
// void test_conversion_to_char()
- BOOST_TEST_EQUAL('A', lexical_cast<char>('A'));
- BOOST_TEST_EQUAL(' ', lexical_cast<char>(' '));
+ LMI_TEST_EQUAL('A', lexical_cast<char>('A'));
+ LMI_TEST_EQUAL(' ', lexical_cast<char>(' '));
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL('1', lexical_cast<char>(1));
- BOOST_TEST_EQUAL('0', lexical_cast<char>(0));
+ LMI_TEST_EQUAL('1', lexical_cast<char>(1));
+ LMI_TEST_EQUAL('0', lexical_cast<char>(0));
// See 'Important note on char types' above.
- BOOST_TEST_THROW(lexical_cast<char>(123), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<char>(123), boost::bad_lexical_cast, "");
// See 'Important note on narrowing conversions' above.
- BOOST_TEST_EQUAL('1', lexical_cast<char>(1.0));
+ LMI_TEST_EQUAL('1', lexical_cast<char>(1.0));
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL('1', lexical_cast<char>(true));
- BOOST_TEST_EQUAL('0', lexical_cast<char>(false));
+ LMI_TEST_EQUAL('1', lexical_cast<char>(true));
+ LMI_TEST_EQUAL('0', lexical_cast<char>(false));
- BOOST_TEST_EQUAL('A', lexical_cast<char>("A"));
+ LMI_TEST_EQUAL('A', lexical_cast<char>("A"));
- BOOST_TEST_EQUAL(' ', lexical_cast<char>(" "));
+ LMI_TEST_EQUAL(' ', lexical_cast<char>(" "));
- BOOST_TEST_THROW(lexical_cast<char>(""), boost::bad_lexical_cast, "");
- BOOST_TEST_THROW(lexical_cast<char>("Test"), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<char>(""), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<char>("Test"), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL('A', lexical_cast<char>(std::string("A")));
- BOOST_TEST_EQUAL(' ', lexical_cast<char>(std::string(" ")));
+ LMI_TEST_EQUAL('A', lexical_cast<char>(std::string("A")));
+ LMI_TEST_EQUAL(' ', lexical_cast<char>(std::string(" ")));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<char>(std::string(""))
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<char>(std::string("Test"))
,boost::bad_lexical_cast
,""
@@ -529,45 +529,45 @@ int boost_tests()
// void test_conversion_to_int()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(1,lexical_cast<int>('1'));
- BOOST_TEST_EQUAL(0,lexical_cast<int>('0'));
+ LMI_TEST_EQUAL(1,lexical_cast<int>('1'));
+ LMI_TEST_EQUAL(0,lexical_cast<int>('0'));
- BOOST_TEST_THROW(lexical_cast<int>('A'),boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(1,lexical_cast<int>(1));
+ LMI_TEST_THROW(lexical_cast<int>('A'),boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(1,lexical_cast<int>(1));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(std::numeric_limits<int>::max()
,lexical_cast<int>(std::numeric_limits<int>::max())
);
- BOOST_TEST_EQUAL(1,lexical_cast<int>(1.0));
+ LMI_TEST_EQUAL(1,lexical_cast<int>(1.0));
- BOOST_TEST_THROW(lexical_cast<int>(1.23), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<int>(1.23), boost::bad_lexical_cast, "");
- BOOST_TEST_THROW(lexical_cast<int>(1e20), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(1, lexical_cast<int>(true));
- BOOST_TEST_EQUAL(0, lexical_cast<int>(false));
- BOOST_TEST_EQUAL(123, lexical_cast<int>("123"));
- BOOST_TEST_THROW
+ LMI_TEST_THROW(lexical_cast<int>(1e20), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(1, lexical_cast<int>(true));
+ LMI_TEST_EQUAL(0, lexical_cast<int>(false));
+ LMI_TEST_EQUAL(123, lexical_cast<int>("123"));
+ LMI_TEST_THROW
(lexical_cast<int>(" 123")
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW(lexical_cast<int>(""), boost::bad_lexical_cast, "");
- BOOST_TEST_THROW(lexical_cast<int>("Test"), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(123, lexical_cast<int>("123"));
- BOOST_TEST_EQUAL(123,lexical_cast<int>(std::string("123")));
- BOOST_TEST_THROW
+ LMI_TEST_THROW(lexical_cast<int>(""), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<int>("Test"), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(123, lexical_cast<int>("123"));
+ LMI_TEST_EQUAL(123,lexical_cast<int>(std::string("123")));
+ LMI_TEST_THROW
(lexical_cast<int>(std::string(" 123"))
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<int>(std::string(""))
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<int>(std::string("Test"))
,boost::bad_lexical_cast
,""
@@ -576,29 +576,29 @@ int boost_tests()
// void test_conversion_to_double()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(1.0, lexical_cast<double>('1'));
+ LMI_TEST_EQUAL(1.0, lexical_cast<double>('1'));
- BOOST_TEST_THROW(lexical_cast<double>('A'), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(1.0, lexical_cast<double>(1));
- BOOST_TEST_EQUAL(1.23, lexical_cast<double>(1.23));
+ LMI_TEST_THROW(lexical_cast<double>('A'), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(1.0, lexical_cast<double>(1));
+ LMI_TEST_EQUAL(1.23, lexical_cast<double>(1.23));
// BOOST_CHECK_CLOSE(
// std::numeric_limits<double>::max() / 2,
// lexical_cast<double>(std::numeric_limits<double>::max() / 2),
// std::numeric_limits<double>::epsilon());
- BOOST_TEST_EQUAL(1.0, lexical_cast<double>(true));
- BOOST_TEST_EQUAL(0.0, lexical_cast<double>(false));
- BOOST_TEST_EQUAL(1.23, lexical_cast<double>("1.23"));
- BOOST_TEST_THROW(lexical_cast<double>(""), boost::bad_lexical_cast, "");
- BOOST_TEST_THROW(lexical_cast<double>("Test"), boost::bad_lexical_cast,
"");
- BOOST_TEST_EQUAL(1.23, lexical_cast<double>(std::string("1.23")));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(1.0, lexical_cast<double>(true));
+ LMI_TEST_EQUAL(0.0, lexical_cast<double>(false));
+ LMI_TEST_EQUAL(1.23, lexical_cast<double>("1.23"));
+ LMI_TEST_THROW(lexical_cast<double>(""), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<double>("Test"), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(1.23, lexical_cast<double>(std::string("1.23")));
+ LMI_TEST_THROW
(lexical_cast<double>(std::string(""))
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<double>(std::string("Test"))
,boost::bad_lexical_cast
,""
@@ -607,34 +607,34 @@ int boost_tests()
// void test_conversion_to_bool()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(true, lexical_cast<bool>('1'));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>('0'));
-
- BOOST_TEST_THROW(lexical_cast<bool>('A'), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(true, lexical_cast<bool>(1));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>(0));
- BOOST_TEST_THROW(lexical_cast<bool>(123), boost::bad_lexical_cast, "");
- BOOST_TEST_EQUAL(true, lexical_cast<bool>(1.0));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>(0.0));
- BOOST_TEST_EQUAL(true, lexical_cast<bool>(true));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>(false));
-
- BOOST_TEST_EQUAL(true, lexical_cast<bool>("1"));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>("0"));
-
- BOOST_TEST_THROW(lexical_cast<bool>(""), boost::bad_lexical_cast, "");
- BOOST_TEST_THROW(lexical_cast<bool>("Test"), boost::bad_lexical_cast, "");
-
- BOOST_TEST_EQUAL(true, lexical_cast<bool>("1"));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>("0"));
- BOOST_TEST_EQUAL(true, lexical_cast<bool>(std::string("1")));
- BOOST_TEST_EQUAL(false, lexical_cast<bool>(std::string("0")));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(true, lexical_cast<bool>('1'));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>('0'));
+
+ LMI_TEST_THROW(lexical_cast<bool>('A'), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(true, lexical_cast<bool>(1));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>(0));
+ LMI_TEST_THROW(lexical_cast<bool>(123), boost::bad_lexical_cast, "");
+ LMI_TEST_EQUAL(true, lexical_cast<bool>(1.0));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>(0.0));
+ LMI_TEST_EQUAL(true, lexical_cast<bool>(true));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>(false));
+
+ LMI_TEST_EQUAL(true, lexical_cast<bool>("1"));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>("0"));
+
+ LMI_TEST_THROW(lexical_cast<bool>(""), boost::bad_lexical_cast, "");
+ LMI_TEST_THROW(lexical_cast<bool>("Test"), boost::bad_lexical_cast, "");
+
+ LMI_TEST_EQUAL(true, lexical_cast<bool>("1"));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>("0"));
+ LMI_TEST_EQUAL(true, lexical_cast<bool>(std::string("1")));
+ LMI_TEST_EQUAL(false, lexical_cast<bool>(std::string("0")));
+ LMI_TEST_THROW
(lexical_cast<bool>(std::string(""))
,boost::bad_lexical_cast
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(lexical_cast<bool>(std::string("Test"))
,boost::bad_lexical_cast
,""
@@ -642,35 +642,35 @@ int boost_tests()
// void test_conversion_to_string()
- BOOST_TEST_EQUAL("A", lexical_cast<std::string>('A'));
- BOOST_TEST_EQUAL(" ", lexical_cast<std::string>(' '));
- BOOST_TEST_EQUAL("123", lexical_cast<std::string>(123));
- BOOST_TEST_EQUAL("1.23", lexical_cast<std::string>(1.23));
- BOOST_TEST_EQUAL("1.111111111", lexical_cast<std::string>(1.111111111));
- BOOST_TEST_EQUAL("1",lexical_cast<std::string>(true));
- BOOST_TEST_EQUAL("0",lexical_cast<std::string>(false));
- BOOST_TEST_EQUAL("Test", lexical_cast<std::string>("Test"));
- BOOST_TEST_EQUAL(" ", lexical_cast<std::string>(" "));
- BOOST_TEST_EQUAL("", lexical_cast<std::string>(""));
- BOOST_TEST_EQUAL("Test", lexical_cast<std::string>(std::string("Test")));
- BOOST_TEST_EQUAL(" ", lexical_cast<std::string>(std::string(" ")));
- BOOST_TEST_EQUAL("", lexical_cast<std::string>(std::string("")));
+ LMI_TEST_EQUAL("A", lexical_cast<std::string>('A'));
+ LMI_TEST_EQUAL(" ", lexical_cast<std::string>(' '));
+ LMI_TEST_EQUAL("123", lexical_cast<std::string>(123));
+ LMI_TEST_EQUAL("1.23", lexical_cast<std::string>(1.23));
+ LMI_TEST_EQUAL("1.111111111", lexical_cast<std::string>(1.111111111));
+ LMI_TEST_EQUAL("1",lexical_cast<std::string>(true));
+ LMI_TEST_EQUAL("0",lexical_cast<std::string>(false));
+ LMI_TEST_EQUAL("Test", lexical_cast<std::string>("Test"));
+ LMI_TEST_EQUAL(" ", lexical_cast<std::string>(" "));
+ LMI_TEST_EQUAL("", lexical_cast<std::string>(""));
+ LMI_TEST_EQUAL("Test", lexical_cast<std::string>(std::string("Test")));
+ LMI_TEST_EQUAL(" ", lexical_cast<std::string>(std::string(" ")));
+ LMI_TEST_EQUAL("", lexical_cast<std::string>(std::string("")));
// void test_conversion_from_to_wchar_t_alias()
- BOOST_TEST_EQUAL(123u, lexical_cast<unsigned short int>("123"));
- BOOST_TEST_EQUAL(123u, lexical_cast<unsigned int>("123"));
- BOOST_TEST_EQUAL(123u, lexical_cast<unsigned long int>("123"));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL(123u, lexical_cast<unsigned short int>("123"));
+ LMI_TEST_EQUAL(123u, lexical_cast<unsigned int>("123"));
+ LMI_TEST_EQUAL(123u, lexical_cast<unsigned long int>("123"));
+ LMI_TEST_EQUAL
(std::string("123")
,lexical_cast<std::string>(static_cast<unsigned short int>(123))
);
- BOOST_TEST_EQUAL(std::string("123"), lexical_cast<std::string>(123u));
- BOOST_TEST_EQUAL(std::string("123"), lexical_cast<std::string>(123ul));
+ LMI_TEST_EQUAL(std::string("123"), lexical_cast<std::string>(123u));
+ LMI_TEST_EQUAL(std::string("123"), lexical_cast<std::string>(123ul));
// void test_conversion_to_pointer()
- BOOST_TEST_THROW(lexical_cast<char *>("Test"), boost::bad_lexical_cast,
"");
+ LMI_TEST_THROW(lexical_cast<char *>("Test"), boost::bad_lexical_cast, "");
#endif // defined TEST_BOOST_IMPLEMENTATION_TOO
// A roughly-equivalent value_cast test suite.
@@ -683,40 +683,40 @@ int boost_tests()
// void test_conversion_to_char()
- BOOST_TEST_EQUAL('A', value_cast<char>('A'));
- BOOST_TEST_EQUAL(' ', value_cast<char>(' '));
+ LMI_TEST_EQUAL('A', value_cast<char>('A'));
+ LMI_TEST_EQUAL(' ', value_cast<char>(' '));
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL('\1', value_cast<char>(1));
- BOOST_TEST_EQUAL('\0', value_cast<char>(0));
+ LMI_TEST_EQUAL('\1', value_cast<char>(1));
+ LMI_TEST_EQUAL('\0', value_cast<char>(0));
// See 'Important note on char types' above.
// boost::lexical_cast<char>(123) throws an exception.
- BOOST_TEST_EQUAL('\123', value_cast<char>(0123));
+ LMI_TEST_EQUAL('\123', value_cast<char>(0123));
// See 'Important note on narrowing conversions' above.
-//F BOOST_TEST_EQUAL('1', value_cast<char>(1.0)); // Suppressed.
+//F LMI_TEST_EQUAL('1', value_cast<char>(1.0)); // Suppressed.
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL('\1', value_cast<char>(true));
- BOOST_TEST_EQUAL('\0', value_cast<char>(false));
+ LMI_TEST_EQUAL('\1', value_cast<char>(true));
+ LMI_TEST_EQUAL('\0', value_cast<char>(false));
-//T BOOST_TEST_EQUAL('A', value_cast<char>("A"));
+//T LMI_TEST_EQUAL('A', value_cast<char>("A"));
-//T BOOST_TEST_EQUAL(' ', value_cast<char>(" "));
+//T LMI_TEST_EQUAL(' ', value_cast<char>(" "));
- BOOST_TEST_THROW(value_cast<char>(""), std::invalid_argument, "");
- BOOST_TEST_THROW(value_cast<char>("Test"), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<char>(""), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<char>("Test"), std::invalid_argument, "");
-//T BOOST_TEST_EQUAL('A', value_cast<char>(std::string("A")));
-//T BOOST_TEST_EQUAL(' ', value_cast<char>(std::string(" ")));
+//T LMI_TEST_EQUAL('A', value_cast<char>(std::string("A")));
+//T LMI_TEST_EQUAL(' ', value_cast<char>(std::string(" ")));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<char>(std::string(""))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<char>(std::string("Test"))
,std::invalid_argument
,""
@@ -725,53 +725,53 @@ int boost_tests()
// void test_conversion_to_int()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(1, value_cast<int>('\1'));
- BOOST_TEST_EQUAL(0, value_cast<int>('\0'));
+ LMI_TEST_EQUAL(1, value_cast<int>('\1'));
+ LMI_TEST_EQUAL(0, value_cast<int>('\0'));
-//X BOOST_TEST_THROW(value_cast<int>('A'), std::invalid_argument, "");
- BOOST_TEST_EQUAL(1, value_cast<int>(1));
+//X LMI_TEST_THROW(value_cast<int>('A'), std::invalid_argument, "");
+ LMI_TEST_EQUAL(1, value_cast<int>(1));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL
(std::numeric_limits<int>::max()
,value_cast<int>(std::numeric_limits<int>::max())
);
- BOOST_TEST_EQUAL(1,value_cast<int>(1.0));
+ LMI_TEST_EQUAL(1,value_cast<int>(1.0));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<int>(1.23)
,std::runtime_error
,lmi_test::what_regex("^Cast.*would not preserve value\\.$")
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<int>(1e20)
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_EQUAL(1, value_cast<int>(true));
- BOOST_TEST_EQUAL(0, value_cast<int>(false));
- BOOST_TEST_EQUAL(123, value_cast<int>("123"));
-//X BOOST_TEST_THROW
+ LMI_TEST_EQUAL(1, value_cast<int>(true));
+ LMI_TEST_EQUAL(0, value_cast<int>(false));
+ LMI_TEST_EQUAL(123, value_cast<int>("123"));
+//X LMI_TEST_THROW
// (value_cast<int>(" 123")
// ,std::invalid_argument
// ,""
// );
- BOOST_TEST_THROW(value_cast<int>(""), std::invalid_argument, "");
- BOOST_TEST_THROW(value_cast<int>("Test"), std::invalid_argument, "");
- BOOST_TEST_EQUAL(123, value_cast<int>("123"));
- BOOST_TEST_EQUAL(123,value_cast<int>(std::string("123")));
-//X BOOST_TEST_THROW
+ LMI_TEST_THROW(value_cast<int>(""), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<int>("Test"), std::invalid_argument, "");
+ LMI_TEST_EQUAL(123, value_cast<int>("123"));
+ LMI_TEST_EQUAL(123,value_cast<int>(std::string("123")));
+//X LMI_TEST_THROW
// (value_cast<int>(std::string(" 123"))
// ,std::invalid_argument
// ,""
// );
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<int>(std::string(""))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<int>(std::string("Test"))
,std::invalid_argument
,""
@@ -780,29 +780,29 @@ int boost_tests()
// void test_conversion_to_double()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(1.0, value_cast<double>('\1'));
+ LMI_TEST_EQUAL(1.0, value_cast<double>('\1'));
-//X BOOST_TEST_THROW(value_cast<double>('A'), std::invalid_argument, "");
- BOOST_TEST_EQUAL(1.0, value_cast<double>(1));
- BOOST_TEST_EQUAL(1.23, value_cast<double>(1.23));
+//X LMI_TEST_THROW(value_cast<double>('A'), std::invalid_argument, "");
+ LMI_TEST_EQUAL(1.0, value_cast<double>(1));
+ LMI_TEST_EQUAL(1.23, value_cast<double>(1.23));
// Boost uses BOOST_CHECK_CLOSE. Should something similar not be
// done here, using lmi's 'materially_equal.hpp'?
double const max_double = std::numeric_limits<double>::max();
- BOOST_TEST_EQUAL(max_double / 2, value_cast<double>(max_double / 2));
-
- BOOST_TEST_EQUAL(1.0, value_cast<double>(true));
- BOOST_TEST_EQUAL(0.0, value_cast<double>(false));
- BOOST_TEST_EQUAL(1.23, value_cast<double>("1.23"));
- BOOST_TEST_THROW(value_cast<double>(""), std::invalid_argument, "");
- BOOST_TEST_THROW(value_cast<double>("Test"), std::invalid_argument, "");
- BOOST_TEST_EQUAL(1.23, value_cast<double>(std::string("1.23")));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(max_double / 2, value_cast<double>(max_double / 2));
+
+ LMI_TEST_EQUAL(1.0, value_cast<double>(true));
+ LMI_TEST_EQUAL(0.0, value_cast<double>(false));
+ LMI_TEST_EQUAL(1.23, value_cast<double>("1.23"));
+ LMI_TEST_THROW(value_cast<double>(""), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<double>("Test"), std::invalid_argument, "");
+ LMI_TEST_EQUAL(1.23, value_cast<double>(std::string("1.23")));
+ LMI_TEST_THROW
(value_cast<double>(std::string(""))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<double>(std::string("Test"))
,std::invalid_argument
,""
@@ -811,50 +811,50 @@ int boost_tests()
// void test_conversion_to_bool()
// See 'Important note on char types' above.
- BOOST_TEST_EQUAL(true, value_cast<bool>('\1'));
- BOOST_TEST_EQUAL(false, value_cast<bool>('\0'));
+ LMI_TEST_EQUAL(true, value_cast<bool>('\1'));
+ LMI_TEST_EQUAL(false, value_cast<bool>('\0'));
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<bool>('A')
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_EQUAL(true, value_cast<bool>(1));
- BOOST_TEST_EQUAL(false, value_cast<bool>(0));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(true, value_cast<bool>(1));
+ LMI_TEST_EQUAL(false, value_cast<bool>(0));
+ LMI_TEST_THROW
(value_cast<bool>(123)
,std::runtime_error
,"Cast would transgress upper limit."
);
- BOOST_TEST_EQUAL(true, value_cast<bool>(1.0));
- BOOST_TEST_EQUAL(false, value_cast<bool>(0.0));
- BOOST_TEST_EQUAL(true, value_cast<bool>(true));
- BOOST_TEST_EQUAL(false, value_cast<bool>(false));
+ LMI_TEST_EQUAL(true, value_cast<bool>(1.0));
+ LMI_TEST_EQUAL(false, value_cast<bool>(0.0));
+ LMI_TEST_EQUAL(true, value_cast<bool>(true));
+ LMI_TEST_EQUAL(false, value_cast<bool>(false));
- BOOST_TEST_EQUAL(true, value_cast<bool>("1"));
- BOOST_TEST_EQUAL(false, value_cast<bool>("0"));
+ LMI_TEST_EQUAL(true, value_cast<bool>("1"));
+ LMI_TEST_EQUAL(false, value_cast<bool>("0"));
// To preserve correspondence to the original boost tests above,
// move these additions elsewhere.
// likewise, for char* rather than char[].
char const* p1 = "1";
- BOOST_TEST_EQUAL(true, value_cast<bool>(p1));
+ LMI_TEST_EQUAL(true, value_cast<bool>(p1));
char const* p0 = "0";
- BOOST_TEST_EQUAL(false, value_cast<bool>(p0));
+ LMI_TEST_EQUAL(false, value_cast<bool>(p0));
- BOOST_TEST_THROW(value_cast<bool>(""), std::invalid_argument, "");
- BOOST_TEST_THROW(value_cast<bool>("Test"), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<bool>(""), std::invalid_argument, "");
+ LMI_TEST_THROW(value_cast<bool>("Test"), std::invalid_argument, "");
- BOOST_TEST_EQUAL(true, value_cast<bool>("1"));
- BOOST_TEST_EQUAL(false, value_cast<bool>("0"));
- BOOST_TEST_EQUAL(true, value_cast<bool>(std::string("1")));
- BOOST_TEST_EQUAL(false, value_cast<bool>(std::string("0")));
- BOOST_TEST_THROW
+ LMI_TEST_EQUAL(true, value_cast<bool>("1"));
+ LMI_TEST_EQUAL(false, value_cast<bool>("0"));
+ LMI_TEST_EQUAL(true, value_cast<bool>(std::string("1")));
+ LMI_TEST_EQUAL(false, value_cast<bool>(std::string("0")));
+ LMI_TEST_THROW
(value_cast<bool>(std::string(""))
,std::invalid_argument
,""
);
- BOOST_TEST_THROW
+ LMI_TEST_THROW
(value_cast<bool>(std::string("Test"))
,std::invalid_argument
,""
@@ -862,35 +862,35 @@ int boost_tests()
// void test_conversion_to_string()
-//F BOOST_TEST_EQUAL("A", value_cast<std::string>('A'));
-//F BOOST_TEST_EQUAL(" ", value_cast<std::string>(' '));
- BOOST_TEST_EQUAL("123", value_cast<std::string>(123));
- BOOST_TEST_EQUAL("1.23", value_cast<std::string>(1.23));
- BOOST_TEST_EQUAL("1.111111111", value_cast<std::string>(1.111111111));
- BOOST_TEST_EQUAL("1",value_cast<std::string>(true));
- BOOST_TEST_EQUAL("0",value_cast<std::string>(false));
- BOOST_TEST_EQUAL("Test", value_cast<std::string>("Test"));
- BOOST_TEST_EQUAL(" ", value_cast<std::string>(" "));
- BOOST_TEST_EQUAL("", value_cast<std::string>(""));
- BOOST_TEST_EQUAL("Test", value_cast<std::string>(std::string("Test")));
- BOOST_TEST_EQUAL(" ", value_cast<std::string>(std::string(" ")));
- BOOST_TEST_EQUAL("", value_cast<std::string>(std::string("")));
+//F LMI_TEST_EQUAL("A", value_cast<std::string>('A'));
+//F LMI_TEST_EQUAL(" ", value_cast<std::string>(' '));
+ LMI_TEST_EQUAL("123", value_cast<std::string>(123));
+ LMI_TEST_EQUAL("1.23", value_cast<std::string>(1.23));
+ LMI_TEST_EQUAL("1.111111111", value_cast<std::string>(1.111111111));
+ LMI_TEST_EQUAL("1",value_cast<std::string>(true));
+ LMI_TEST_EQUAL("0",value_cast<std::string>(false));
+ LMI_TEST_EQUAL("Test", value_cast<std::string>("Test"));
+ LMI_TEST_EQUAL(" ", value_cast<std::string>(" "));
+ LMI_TEST_EQUAL("", value_cast<std::string>(""));
+ LMI_TEST_EQUAL("Test", value_cast<std::string>(std::string("Test")));
+ LMI_TEST_EQUAL(" ", value_cast<std::string>(std::string(" ")));
+ LMI_TEST_EQUAL("", value_cast<std::string>(std::string("")));
// void test_conversion_from_to_wchar_t_alias()
- BOOST_TEST_EQUAL(123u, value_cast<unsigned short int>("123"));
- BOOST_TEST_EQUAL(123u, value_cast<unsigned int>("123"));
- BOOST_TEST_EQUAL(123u, value_cast<unsigned long int>("123"));
- BOOST_TEST_EQUAL
+ LMI_TEST_EQUAL(123u, value_cast<unsigned short int>("123"));
+ LMI_TEST_EQUAL(123u, value_cast<unsigned int>("123"));
+ LMI_TEST_EQUAL(123u, value_cast<unsigned long int>("123"));
+ LMI_TEST_EQUAL
(std::string("123")
,value_cast<std::string>(static_cast<unsigned short int>(123))
);
- BOOST_TEST_EQUAL(std::string("123"), value_cast<std::string>(123u));
- BOOST_TEST_EQUAL(std::string("123"), value_cast<std::string>(123ul));
+ LMI_TEST_EQUAL(std::string("123"), value_cast<std::string>(123u));
+ LMI_TEST_EQUAL(std::string("123"), value_cast<std::string>(123ul));
// void test_conversion_to_pointer()
-//Z BOOST_TEST_THROW(value_cast<char *>("Test"), std::invalid_argument, "");
+//Z LMI_TEST_THROW(value_cast<char *>("Test"), std::invalid_argument, "");
return 0;
}
diff --git a/vector_test.cpp b/vector_test.cpp
index a3fe26d..74af6c5 100644
--- a/vector_test.cpp
+++ b/vector_test.cpp
@@ -137,23 +137,23 @@ void demo0()
// We can use it to add just one pair if we like.
double r;
std::transform(u, 1 + u, v, &r, std::plus<double>());
- BOOST_TEST(materially_equal(6.8, r));
+ LMI_TEST(materially_equal(6.8, r));
// Here's an equivalent using our new code.
r = *binary_expression<double const*,double const*,plus>(u, v);
- BOOST_TEST(materially_equal(6.8, r));
+ LMI_TEST(materially_equal(6.8, r));
// This type embodies everything we need to know to add pairs of
// values during iteration.
typedef binary_expression<double const*,double const*,plus> Add;
- BOOST_TEST(materially_equal(6.8, *Add(u, v)));
+ LMI_TEST(materially_equal(6.8, *Add(u, v)));
// Since 'Add' is a class type, we can construct an instance and
// exercise its operator*() and operator++() separately.
Add a(u, v);
- BOOST_TEST(materially_equal(6.8, *a));
+ LMI_TEST(materially_equal(6.8, *a));
++a;
- BOOST_TEST(materially_equal(11.2, *a));
+ LMI_TEST(materially_equal(11.2, *a));
}
// As this example shows, we have something equivalent to std::plus
@@ -237,16 +237,16 @@ void demo1()
w = u + v;
- BOOST_TEST(materially_equal(w[0], 0.0));
- BOOST_TEST(materially_equal(w[1], 4.6));
- BOOST_TEST(materially_equal(w[2], 9.2));
- BOOST_TEST(materially_equal(w[3], 13.8));
- BOOST_TEST(materially_equal(w[4], 18.4));
- BOOST_TEST(materially_equal(w[5], 23.0));
- BOOST_TEST(materially_equal(w[6], 27.6));
- BOOST_TEST(materially_equal(w[7], 32.2));
- BOOST_TEST(materially_equal(w[8], 36.8));
- BOOST_TEST(materially_equal(w[9], 41.4));
+ LMI_TEST(materially_equal(w[0], 0.0));
+ LMI_TEST(materially_equal(w[1], 4.6));
+ LMI_TEST(materially_equal(w[2], 9.2));
+ LMI_TEST(materially_equal(w[3], 13.8));
+ LMI_TEST(materially_equal(w[4], 18.4));
+ LMI_TEST(materially_equal(w[5], 23.0));
+ LMI_TEST(materially_equal(w[6], 27.6));
+ LMI_TEST(materially_equal(w[7], 32.2));
+ LMI_TEST(materially_equal(w[8], 36.8));
+ LMI_TEST(materially_equal(w[9], 41.4));
}
// Obviously class simple_array0 is very limited: for instance, this:
@@ -337,11 +337,11 @@ void time_one_array_length(int length)
int const n = -1 + g_array_length;
int const max_seconds = 1;
double const c = TimeAnAliquot(mete_c , max_seconds).unit_time();
- BOOST_TEST_EQUAL(g_w [n], 2.0 * n);
+ LMI_TEST_EQUAL(g_w [n], 2.0 * n);
double const et = TimeAnAliquot(mete_et, max_seconds).unit_time();
- BOOST_TEST_EQUAL(g_w [n], 2.0 * n);
+ LMI_TEST_EQUAL(g_w [n], 2.0 * n);
double const va = TimeAnAliquot(mete_va, max_seconds).unit_time();
- BOOST_TEST_EQUAL(g_va_w[n], 2.0 * n);
+ LMI_TEST_EQUAL(g_va_w[n], 2.0 * n);
std::cout
<< std::setw( 7) << g_array_length
<< std::setw(15) << std::setprecision(3) << std::scientific << c
diff --git a/xml_serialize_test.cpp b/xml_serialize_test.cpp
index 80daccb..3020870 100644
--- a/xml_serialize_test.cpp
+++ b/xml_serialize_test.cpp
@@ -182,38 +182,38 @@ int test_main(int, char*[])
// Not every floating-point number would remain invariant through
// serialization, but the base of natural logarithms does: see the
// documentation for value_cast<>().
- BOOST_TEST(d0 == d1);
- BOOST_TEST_EQUAL(d0, d1);
+ LMI_TEST(d0 == d1);
+ LMI_TEST_EQUAL(d0, d1);
- BOOST_TEST(s0 == s1);
- BOOST_TEST_EQUAL(s0, s1);
+ LMI_TEST(s0 == s1);
+ LMI_TEST_EQUAL(s0, s1);
- // BOOST_TEST_EQUAL() inserts unequal values into an ostream, so
+ // LMI_TEST_EQUAL() inserts unequal values into an ostream, so
// it can only be used with streamable types (as above).
- BOOST_TEST(p0 == p1);
+ LMI_TEST(p0 == p1);
// For Containers, test both
// P: c0 == c1
// Q: c0.size() == c1.size()
// even though P implies Q, because Q AND ~P is easy to detect.
- BOOST_TEST(v0 == v1);
- BOOST_TEST_EQUAL(v0.size(), v1.size());
+ LMI_TEST(v0 == v1);
+ LMI_TEST_EQUAL(v0.size(), v1.size());
- BOOST_TEST(o0 == o1);
- BOOST_TEST_EQUAL(o0.size(), o1.size());
+ LMI_TEST(o0 == o1);
+ LMI_TEST_EQUAL(o0.size(), o1.size());
- BOOST_TEST(u0 == u1);
- BOOST_TEST_EQUAL(u0.size(), u1.size());
+ LMI_TEST(u0 == u1);
+ LMI_TEST_EQUAL(u0.size(), u1.size());
std::string found
("Assertion 'parent.end() == parent.find(name.c_str())' failed."
);
- BOOST_TEST_THROW(write_erroneous(), std::runtime_error, found);
+ LMI_TEST_THROW(write_erroneous(), std::runtime_error, found);
std::string not_found("Required element 'f' not found.");
- BOOST_TEST_THROW(read_erroneous(), std::runtime_error, not_found);
+ LMI_TEST_THROW(read_erroneous(), std::runtime_error, not_found);
std::cout << " Speed tests...\n";
std::cout << " Write empty : " << TimeAnAliquot(mete_write_0) << '\n';
diff --git a/zero_test.cpp b/zero_test.cpp
index d576da5..c29d0b8 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -40,11 +40,11 @@ void test_zero(double bound0, double bound1, int dec, F f,
double exact_root)
root_type rl = decimal_root(bound0, bound1, bias_lower, dec, f);
root_type rh = decimal_root(bound0, bound1, bias_higher, dec, f);
- BOOST_TEST(root_is_valid == rn.second);
- BOOST_TEST(root_is_valid == rl.second);
- BOOST_TEST(root_is_valid == rh.second);
+ LMI_TEST(root_is_valid == rn.second);
+ LMI_TEST(root_is_valid == rl.second);
+ LMI_TEST(root_is_valid == rh.second);
- BOOST_TEST(rl.first <= rn.first && rn.first <= rh.first);
+ LMI_TEST(rl.first <= rn.first && rn.first <= rh.first);
double tol =
std::pow(10.0, -dec)
@@ -52,19 +52,19 @@ void test_zero(double bound0, double bound1, int dec, F f,
double exact_root)
(std::fabs(rl.first), std::fabs(rh.first)
)
;
- BOOST_TEST((rh.first - rl.first) <= tol);
+ LMI_TEST((rh.first - rl.first) <= tol);
double toll =
std::pow(10.0, -dec)
+ 6.0 * epsilon * std::fabs(rl.first)
;
- BOOST_TEST((rl.first - exact_root) <= toll);
+ LMI_TEST((rl.first - exact_root) <= toll);
double tolh =
std::pow(10.0, -dec)
+ 6.0 * epsilon * std::fabs(rh.first)
;
- BOOST_TEST((rh.first - exact_root) <= tolh);
+ LMI_TEST((rh.first - exact_root) <= tolh);
}
double e_function(double z)
@@ -112,18 +112,18 @@ int test_main(int, char*[])
// Test use with function.
root_type r = decimal_root(0.5, 5.0, bias_none, 9, e_function);
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
// Test use with function object.
e_functor e;
r = decimal_root(0.5, 5.0, bias_none, 9, e);
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
// Test failure with interval containing no root.
r = decimal_root(0.1, 1.0, bias_none, 9, e);
- BOOST_TEST(root_not_bracketed == r.second);
+ LMI_TEST(root_not_bracketed == r.second);
// Test guaranteed side effects.
@@ -132,22 +132,22 @@ int test_main(int, char*[])
// bounds.
r = decimal_root(0.5, 5.0, bias_lower, 9, e, true);
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
double e_or_less = r.first;
r = decimal_root(0.5, 5.0, bias_higher, 9, e, true);
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
double e_or_more = r.first;
- BOOST_TEST(e_or_less < e_or_more);
+ LMI_TEST(e_or_less < e_or_more);
r = decimal_root(0.5, 5.0, bias_lower, 9, e, true);
- BOOST_TEST(root_is_valid == r.second);
- BOOST_TEST(r.first < std::exp(1.0));
- BOOST_TEST(e.value < std::exp(1.0));
+ LMI_TEST(root_is_valid == r.second);
+ LMI_TEST(r.first < std::exp(1.0));
+ LMI_TEST(e.value < std::exp(1.0));
r = decimal_root(0.5, 5.0, bias_higher, 9, e, true);
- BOOST_TEST(root_is_valid == r.second);
- BOOST_TEST(std::exp(1.0) < r.first);
- BOOST_TEST(std::exp(1.0) < e.value);
+ LMI_TEST(root_is_valid == r.second);
+ LMI_TEST(std::exp(1.0) < r.first);
+ LMI_TEST(std::exp(1.0) < e.value);
// Various tests--see macro definition.
@@ -174,7 +174,7 @@ int test_main(int, char*[])
e_nineteenth e_19;
r = decimal_root(-1.0, 4.0, bias_none, -20, e_19);
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
test_zero(-1.0, 4.0, -100, e_19, std::exp(1.0));
test_zero(-1.0, 4.0, 0, e_19, std::exp(1.0));
@@ -183,7 +183,7 @@ int test_main(int, char*[])
e_former_rounding_problem e_frp;
r = decimal_root(0.12609, 0.12611, bias_lower, 5, e_frp);
#if !defined LMI_COMO_WITH_MINGW
- BOOST_TEST(materially_equal(0.12610, r.first));
+ LMI_TEST(materially_equal(0.12610, r.first));
#else // defined LMI_COMO_WITH_MINGW
// One would naively expect 0.12610 to be the answer, but it's
// necessary to inquire which of the two closest representations
@@ -194,13 +194,13 @@ int test_main(int, char*[])
// (see documentation of the rounding library and its unit test)
// resulting in a final iterand whose function value is slightly
// different from zero, and in the "wrong" direction.
- BOOST_TEST
+ LMI_TEST
( materially_equal(0.12609, r.first)
|| materially_equal(0.12610, r.first)
);
#endif // defined LMI_COMO_WITH_MINGW
- BOOST_TEST(root_is_valid == r.second);
+ LMI_TEST(root_is_valid == r.second);
return 0;
}