Commit 9a8ed037 authored by Davis King's avatar Davis King

Switched all the test statements in the regression test suite from

DLIB_CASSERT to DLIB_TEST and DLIB_TEST_MSG.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402975
parent 574215ed
This diff is collapsed.
This diff is collapsed.
......@@ -59,7 +59,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(wiki_encoded);
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == wiki_normal,
DLIB_TEST_MSG(sout.str() == wiki_normal,
"sout.str(): " << sout.str() <<
"\nwiki_normal: " << wiki_normal);
......@@ -91,7 +91,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
}
sin.clear();
DLIB_CASSERT(a == b,
DLIB_TEST_MSG(a == b,
"a: \n" << a <<
"\n\nb: \n" << b);
......@@ -104,7 +104,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(sout.str());
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == "","");
DLIB_TEST(sout.str() == "");
sin.clear();
sin.str("a");
......@@ -113,7 +113,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(sout.str());
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == "a","");
DLIB_TEST(sout.str() == "a");
sin.clear();
sin.str("da");
......@@ -122,7 +122,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(sout.str());
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == "da","");
DLIB_TEST(sout.str() == "da");
sin.clear();
sin.str("dav");
......@@ -131,7 +131,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(sout.str());
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == "dav","");
DLIB_TEST(sout.str() == "dav");
sin.clear();
sin.str("davi");
......@@ -140,7 +140,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sin.str(sout.str());
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(sout.str() == "davi","");
DLIB_TEST(sout.str() == "davi");
for (int i = 0; i < 1000; ++i)
......@@ -165,7 +165,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
sout.str("");
test.decode(sin,sout);
DLIB_CASSERT(str == sout.str(),"");
DLIB_TEST(str == sout.str());
}
......@@ -176,7 +176,7 @@ LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
}
catch (typename base64::decode_error& e)
{
DLIB_CASSERT(false,
DLIB_TEST_MSG(false,
"decode_error thrown when it shouldn't have been (" << seed << "):\n "
<< e.info);
}
......
......@@ -75,10 +75,10 @@ namespace
ostringstream sout;
serialize(bn, sout);
bn.clear();
DLIB_CASSERT(bn.number_of_nodes() == 0,"");
DLIB_TEST(bn.number_of_nodes() == 0);
istringstream sin(sout.str());
deserialize(bn, sin);
DLIB_CASSERT(bn.number_of_nodes() == 3,"");
DLIB_TEST(bn.number_of_nodes() == 3);
}
......@@ -209,10 +209,10 @@ namespace
ostringstream sout;
serialize(bn, sout);
bn.clear();
DLIB_CASSERT(bn.number_of_nodes() == 0,"");
DLIB_TEST(bn.number_of_nodes() == 0);
istringstream sin(sout.str());
deserialize(bn, sin);
DLIB_CASSERT(bn.number_of_nodes() == 8,"");
DLIB_TEST(bn.number_of_nodes() == 8);
}
......@@ -242,36 +242,36 @@ namespace
matrix<double,1,2> dist;
dist = solution.probability(A);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.01 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.01 ) < 1e-5);
dist = solution.probability(T);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.0104) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.0104) < 1e-5);
dist = solution.probability(O);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.064828) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.064828) < 1e-5);
dist = solution.probability(X);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.11029004) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.11029004) < 1e-5);
dist = solution.probability(L);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.055) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.055) < 1e-5);
dist = solution.probability(S);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.5) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.5) < 1e-5);
dist = solution.probability(B);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.4499999) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.4499999) < 1e-5);
dist = solution.probability(D);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.4359706 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.4359706 ) < 1e-5);
// now lets modify the probabilities of the bayesian network by making O
// not a deterministic node anymore but otherwise leave the network alone
......@@ -287,39 +287,39 @@ namespace
// reload the solution now that we have changed the probabilities of node O
bayesian_network_join_tree(bn, join_tree).swap(solution);
DLIB_CASSERT(solution.number_of_nodes() == bn.number_of_nodes(),"");
DLIB_TEST(solution.number_of_nodes() == bn.number_of_nodes());
dist = solution.probability(A);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 1.0 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 1.0 ) < 1e-5);
dist = solution.probability(T);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.253508694039 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.253508694039 ) < 1e-5);
dist = solution.probability(O);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.77856184024 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.77856184024 ) < 1e-5);
dist = solution.probability(X);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 1.0 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 1.0 ) < 1e-5);
dist = solution.probability(L);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.5070173880 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.5070173880 ) < 1e-5);
dist = solution.probability(S);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 1.0 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 1.0 ) < 1e-5);
dist = solution.probability(B);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.6 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.6 ) < 1e-5);
dist = solution.probability(D);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.7535685520 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.7535685520 ) < 1e-5);
// now lets test the bayesian_network_gibbs_sampler
......@@ -354,33 +354,33 @@ namespace
counts /= rounds;
DLIB_CASSERT(abs(counts(A) - 1.0 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(T) - 0.253508694039 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(O) - 0.77856184024 ) < 1e-2,abs(counts(O) - 0.77856184024 ) );
DLIB_CASSERT(abs(counts(X) - 1.0 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(L) - 0.5070173880 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(S) - 1.0 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(B) - 0.6 ) < 1e-2,"");
DLIB_CASSERT(abs(counts(D) - 0.7535685520 ) < 1e-2,"");
DLIB_TEST(abs(counts(A) - 1.0 ) < 1e-2);
DLIB_TEST(abs(counts(T) - 0.253508694039 ) < 1e-2);
DLIB_TEST_MSG(abs(counts(O) - 0.77856184024 ) < 1e-2,abs(counts(O) - 0.77856184024 ) );
DLIB_TEST(abs(counts(X) - 1.0 ) < 1e-2);
DLIB_TEST(abs(counts(L) - 0.5070173880 ) < 1e-2);
DLIB_TEST(abs(counts(S) - 1.0 ) < 1e-2);
DLIB_TEST(abs(counts(B) - 0.6 ) < 1e-2);
DLIB_TEST(abs(counts(D) - 0.7535685520 ) < 1e-2);
setup_simple_network(bn);
create_moral_graph(bn, join_tree);
create_join_tree(join_tree, join_tree);
bayesian_network_join_tree(bn, join_tree).swap(solution);
DLIB_CASSERT(solution.number_of_nodes() == bn.number_of_nodes(),"");
DLIB_TEST(solution.number_of_nodes() == bn.number_of_nodes());
dist = solution.probability(A);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.1 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.1 ) < 1e-5);
dist = solution.probability(T);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.5 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.5 ) < 1e-5);
dist = solution.probability(S);
DLIB_CASSERT(abs(sum(dist) - 1.0) < 1e-5,"");
DLIB_CASSERT(abs(dist(1) - 0.5 ) < 1e-5,"");
DLIB_TEST(abs(sum(dist) - 1.0) < 1e-5);
DLIB_TEST(abs(dist(1) - 0.5 ) < 1e-5);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -82,7 +82,7 @@ namespace
}
DLIB_CASSERT(detected_error || sout.str() == old_buffer,(unsigned int)sout.str().size());
DLIB_TEST_MSG(detected_error || sout.str() == old_buffer,(unsigned int)sout.str().size());
......@@ -116,7 +116,7 @@ namespace
sin.str(sout.str());
sout.str("");
test.decompress(sin,sout);
DLIB_CASSERT(sout.str() == buffer,"");
DLIB_TEST(sout.str() == buffer);
}
print_spinner();
......@@ -153,7 +153,7 @@ namespace
sout.str("");
test.decompress(sin,sout);
buffer = ch;
DLIB_CASSERT(sout.str() == buffer,"");
DLIB_TEST(sout.str() == buffer);
......@@ -161,7 +161,7 @@ namespace
sout.str("");
test.decompress(sin,sout);
buffer = ch2;
DLIB_CASSERT(sout.str() == buffer,"");
DLIB_TEST(sout.str() == buffer);
}
......@@ -175,7 +175,7 @@ namespace
sin.str(sout.str());
sout.str("");
test.decompress(sin,sout);
DLIB_CASSERT(sout.str() == "",sout.str());
DLIB_TEST_MSG(sout.str() == "",sout.str());
......@@ -206,7 +206,7 @@ namespace
print_spinner();
test.decompress(sin,sout);
DLIB_CASSERT(sout.str() == buffer,"");
DLIB_TEST(sout.str() == buffer);
print_spinner();
}
......@@ -247,7 +247,7 @@ namespace
print_spinner();
test.decompress(sin,sout);
DLIB_CASSERT(sout.str() == buffer,"");
DLIB_TEST(sout.str() == buffer);
print_spinner();
......
This diff is collapsed.
......@@ -27,36 +27,36 @@ namespace
config_reader& cr
)
{
DLIB_CASSERT(cr.is_key_defined("global"),"");
DLIB_CASSERT(cr.is_block_defined("all"),"");
DLIB_CASSERT(cr.is_key_defined("globalasfd") == false,"");
DLIB_CASSERT(cr.is_block_defined("all!") == false,"");
DLIB_CASSERT(cr.size() == 1,"");
DLIB_CASSERT(cr["global"] == "hmm","");
DLIB_CASSERT(cr["global2"] == "hmm2","");
DLIB_CASSERT(cr.block("all").size() == 4,"");
DLIB_CASSERT(cr.block("all").block("block1").size() == 0,"");
DLIB_CASSERT(cr.block("all").block("block2").size() == 0,"");
DLIB_CASSERT(cr.block("all").block("block3").size() == 0,"");
DLIB_CASSERT(cr.block("all").block("block4").size() == 0,"");
DLIB_CASSERT(cr.block("all").block("block1").is_key_defined("name"),"");
DLIB_CASSERT(cr.block("all").block("block2").is_key_defined("name"),"");
DLIB_CASSERT(cr.block("all").block("block3").is_key_defined("name"),"");
DLIB_CASSERT(cr.block("all").block("block4").is_key_defined("name"),"");
DLIB_CASSERT(cr.block("all").block("block1").is_key_defined("age"),"");
DLIB_CASSERT(cr.block("all").block("block2").is_key_defined("age"),"");
DLIB_CASSERT(cr.block("all").block("block3").is_key_defined("age"),"");
DLIB_CASSERT(cr.block("all").block("block4").is_key_defined("age"),"");
DLIB_CASSERT(cr.block("all").block("block1")["name"] == "davis king","");
DLIB_CASSERT(cr.block("all").block("block2")["name"] == "joel","");
DLIB_CASSERT(cr.block("all").block("block3")["name"] == "john","");
DLIB_CASSERT(cr.block("all").block("block4")["name"] == "dude","");
DLIB_CASSERT(cr.block("all").block("block1")["age"] == "24","");
DLIB_CASSERT(cr.block("all").block("block2")["age"] == "24","");
DLIB_CASSERT(cr.block("all").block("block3")["age"] == "24","");
DLIB_CASSERT(cr.block("all").block("block4")["age"] == "53","");
DLIB_TEST(cr.is_key_defined("global"));
DLIB_TEST(cr.is_block_defined("all"));
DLIB_TEST(cr.is_key_defined("globalasfd") == false);
DLIB_TEST(cr.is_block_defined("all!") == false);
DLIB_TEST(cr.size() == 1);
DLIB_TEST(cr["global"] == "hmm");
DLIB_TEST(cr["global2"] == "hmm2");
DLIB_TEST(cr.block("all").size() == 4);
DLIB_TEST(cr.block("all").block("block1").size() == 0);
DLIB_TEST(cr.block("all").block("block2").size() == 0);
DLIB_TEST(cr.block("all").block("block3").size() == 0);
DLIB_TEST(cr.block("all").block("block4").size() == 0);
DLIB_TEST(cr.block("all").block("block1").is_key_defined("name"));
DLIB_TEST(cr.block("all").block("block2").is_key_defined("name"));
DLIB_TEST(cr.block("all").block("block3").is_key_defined("name"));
DLIB_TEST(cr.block("all").block("block4").is_key_defined("name"));
DLIB_TEST(cr.block("all").block("block1").is_key_defined("age"));
DLIB_TEST(cr.block("all").block("block2").is_key_defined("age"));
DLIB_TEST(cr.block("all").block("block3").is_key_defined("age"));
DLIB_TEST(cr.block("all").block("block4").is_key_defined("age"));
DLIB_TEST(cr.block("all").block("block1")["name"] == "davis king");
DLIB_TEST(cr.block("all").block("block2")["name"] == "joel");
DLIB_TEST(cr.block("all").block("block3")["name"] == "john");
DLIB_TEST(cr.block("all").block("block4")["name"] == "dude");
DLIB_TEST(cr.block("all").block("block1")["age"] == "24");
DLIB_TEST(cr.block("all").block("block2")["age"] == "24");
DLIB_TEST(cr.block("all").block("block3")["age"] == "24");
DLIB_TEST(cr.block("all").block("block4")["age"] == "53");
int count1 = 0;
......@@ -64,26 +64,26 @@ namespace
while (cr.move_next())
{
++count1;
DLIB_CASSERT(cr.current_block_name() == "all","");
DLIB_CASSERT(cr.element().is_key_defined("global") == false,"");
DLIB_CASSERT(cr.element().is_key_defined("global2") == false,"");
DLIB_CASSERT(cr.element().is_key_defined("name") == false,"");
DLIB_CASSERT(cr.element().is_key_defined("age") == false,"");
DLIB_TEST(cr.current_block_name() == "all");
DLIB_TEST(cr.element().is_key_defined("global") == false);
DLIB_TEST(cr.element().is_key_defined("global2") == false);
DLIB_TEST(cr.element().is_key_defined("name") == false);
DLIB_TEST(cr.element().is_key_defined("age") == false);
while (cr.element().move_next())
{
++count2;
ostringstream sout;
sout << "block" << count2;
DLIB_CASSERT(cr.element().current_block_name() == sout.str(),"");
DLIB_CASSERT(cr.element().size() == 4,"");
DLIB_CASSERT(cr.element().element().size() == 0,"");
DLIB_CASSERT(cr.element().element().is_key_defined("name"),"");
DLIB_CASSERT(cr.element().element().is_key_defined("age"),"");
DLIB_TEST(cr.element().current_block_name() == sout.str());
DLIB_TEST(cr.element().size() == 4);
DLIB_TEST(cr.element().element().size() == 0);
DLIB_TEST(cr.element().element().is_key_defined("name"));
DLIB_TEST(cr.element().element().is_key_defined("age"));
}
}
DLIB_CASSERT(count1 == 1,"");
DLIB_CASSERT(count2 == 4,"");
DLIB_TEST(count1 == 1);
DLIB_TEST(count2 == 4);
}
......@@ -163,8 +163,8 @@ namespace
do_the_tests(cr2);
cr.clear();
DLIB_CASSERT(cr.size() == 0,"");
DLIB_CASSERT(cr.is_key_defined("global") == false,"");
DLIB_TEST(cr.size() == 0);
DLIB_TEST(cr.is_key_defined("global") == false);
}
......@@ -215,10 +215,10 @@ namespace
catch (typename config_reader::config_reader_error& e)
{
error_found = true;
DLIB_CASSERT(e.line_number == 16,"");
DLIB_CASSERT(e.redefinition == false,"");
DLIB_TEST(e.line_number == 16);
DLIB_TEST(e.redefinition == false);
}
DLIB_CASSERT(error_found,"");
DLIB_TEST(error_found);
}
{
......@@ -268,10 +268,10 @@ namespace
catch (typename config_reader::config_reader_error& e)
{
error_found = true;
DLIB_CASSERT(e.line_number == 31,e.line_number);
DLIB_CASSERT(e.redefinition == true,"");
DLIB_TEST_MSG(e.line_number == 31,e.line_number);
DLIB_TEST(e.redefinition == true);
}
DLIB_CASSERT(error_found,"");
DLIB_TEST(error_found);
}
......@@ -321,10 +321,10 @@ namespace
catch (typename config_reader::config_reader_error& e)
{
error_found = true;
DLIB_CASSERT(e.line_number == 13,e.line_number);
DLIB_CASSERT(e.redefinition == true,"");
DLIB_TEST_MSG(e.line_number == 13,e.line_number);
DLIB_TEST(e.redefinition == true);
}
DLIB_CASSERT(error_found,"");
DLIB_TEST(error_found);
}
......
This diff is collapsed.
......@@ -59,12 +59,12 @@ namespace
DLIB_CASSERT(e.stream_is_set() == false,"");
DLIB_TEST(e.stream_is_set() == false);
e.set_stream(sout);
DLIB_CASSERT(e.stream_is_set() == true,"");
DLIB_CASSERT(&e.get_stream() == &sout,"");
DLIB_TEST(e.stream_is_set() == true);
DLIB_TEST(&e.get_stream() == &sout);
unsigned char ch;
......@@ -98,14 +98,14 @@ namespace
counts[ch] += 1;
}
DLIB_CASSERT(e.stream_is_set() == true,"");
DLIB_CASSERT(&e.get_stream() == &sout,"");
DLIB_TEST(e.stream_is_set() == true);
DLIB_TEST(&e.get_stream() == &sout);
e.clear();
DLIB_CASSERT(e.stream_is_set() == false,"");
DLIB_TEST(e.stream_is_set() == false);
// *****************************************
......@@ -114,18 +114,18 @@ namespace
decoder d;
DLIB_CASSERT(d.stream_is_set() == false,"");
DLIB_CASSERT(d.get_target_called() == false,"");
DLIB_TEST(d.stream_is_set() == false);
DLIB_TEST(d.get_target_called() == false);
sin.str(sout.str());
sout.str("");
d.set_stream(sin);
DLIB_CASSERT(d.get_target_called() == false,"");
DLIB_TEST(d.get_target_called() == false);
DLIB_CASSERT(d.stream_is_set() == true,"");
DLIB_CASSERT(&d.get_stream() == &sin,"");
DLIB_TEST(d.stream_is_set() == true);
DLIB_TEST(&d.get_stream() == &sin);
for (int i = 0; i < 256; ++i)
{
......@@ -149,13 +149,13 @@ namespace
}
}
DLIB_CASSERT(d.get_target_called() == false,"");
DLIB_TEST(d.get_target_called() == false);
unsigned long target = d.get_target(total);
DLIB_CASSERT(target < total,"");
DLIB_TEST(target < total);
DLIB_CASSERT(d.get_target_called() == true,"");
DLIB_TEST(d.get_target_called() == true);
unsigned long low_count;
......@@ -178,19 +178,19 @@ namespace
d.decode(low_count,high_count);
DLIB_CASSERT(d.get_target_called() == false,"");
DLIB_TEST(d.get_target_called() == false);
++total;
counts[ch] += 1;
}
DLIB_CASSERT(d.stream_is_set() == true,"");
DLIB_CASSERT(&d.get_stream() == &sin,"");
DLIB_TEST(d.stream_is_set() == true);
DLIB_TEST(&d.get_stream() == &sin);
d.clear();
DLIB_CASSERT(d.stream_is_set() == false,"");
DLIB_CASSERT(sout.str().size() == input.size(),"the test script is buggy");
DLIB_TEST(d.stream_is_set() == false);
DLIB_TEST_MSG(sout.str().size() == input.size(),"the test script is buggy");
if (sout.str() == input)
......@@ -264,7 +264,7 @@ namespace
for (int i = 0; i < num; ++i)
{
unsigned long N = d.get_target(total[i]);
DLIB_CASSERT(low_count[i] <= N && N < high_count[i],"");
DLIB_TEST(low_count[i] <= N && N < high_count[i]);
d.decode(low_count[i],high_count[i]);
}
......@@ -273,13 +273,13 @@ namespace
DLIB_CASSERT(sin.rdbuf()->sgetc() != EOF,"num: " << num);
DLIB_CASSERT(sin.rdbuf()->sgetc() == 'a',
DLIB_TEST_MSG(sin.rdbuf()->sgetc() != EOF,"num: " << num);
DLIB_TEST_MSG(sin.rdbuf()->sgetc() == 'a',
"sin.rdbuf()->sgetc() == " << (char)sin.rdbuf()->sgetc() <<
"\nnum: " << num
);
DLIB_CASSERT(sin.rdbuf()->sbumpc() == 'a',"");
DLIB_CASSERT(sin.rdbuf()->sgetc() == EOF,"");
DLIB_TEST(sin.rdbuf()->sbumpc() == 'a');
DLIB_TEST(sin.rdbuf()->sgetc() == EOF);
} // for (int k = 0; k < 10000; ++k)
......@@ -298,7 +298,7 @@ namespace
d.set_stream(sin);
unsigned long total = ::rand()%256 + 20;
unsigned long target = d.get_target(total);
DLIB_CASSERT(target<total,"");
DLIB_TEST(target<total);
for (int i = 0; i < 30; ++i)
{
......@@ -311,7 +311,7 @@ namespace
d.decode(low_count,high_count);
target = d.get_target(total);
DLIB_CASSERT(target<total,"target: " << target << " total: " << total);
DLIB_TEST_MSG(target<total,"target: " << target << " total: " << total);
}
}
......@@ -365,12 +365,12 @@ namespace
{
int k = 0;
DLIB_CASSERT(temp != temp2,"");
DLIB_TEST(temp != temp2);
while (temp[k] == temp2[k])++k;
}
DLIB_CASSERT(temp2 == "","")
DLIB_TEST_MSG(temp2 == "","")
}
}
......@@ -395,7 +395,7 @@ namespace
string::size_type pos = temp.find_first_not_of("e");
temp = temp.substr(pos);
}
DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"") /**/
DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"") /**/
dlog << LTRACE << 5;
......@@ -403,16 +403,16 @@ namespace
print_spinner();
temp = "davis";
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")
temp = "";
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")
// test for each single character
for ( int i = 0; i <= 255; ++i)
{
temp = (unsigned char)i;
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")
}
dlog << LTRACE << 6;
......@@ -423,7 +423,7 @@ namespace
{
temp = temp + temp;
}
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")
dlog << LTRACE << 7;
......@@ -437,7 +437,7 @@ namespace
int a = ::rand()%256;
temp += (unsigned char)a;
}
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")
}
......@@ -457,7 +457,7 @@ namespace
int a = ::rand()%256;
temp += (unsigned char)a;
}
temp = test<encoder,decoder>(temp); DLIB_CASSERT(temp == "","seed: " << seed)
temp = test<encoder,decoder>(temp); DLIB_TEST_MSG(temp == "","seed: " << seed)
}
......@@ -478,7 +478,7 @@ namespace
string::size_type pos = temp.find_first_not_of(" ");
temp = temp.substr(pos);
}
DLIB_CASSERT(temp == "","decoded string: \"" << temp << "\"")/**/
DLIB_TEST_MSG(temp == "","decoded string: \"" << temp << "\"")/**/
......@@ -504,7 +504,7 @@ namespace
temp += temp2;
print_spinner();
temp = test<encoder,decoder>(temp);
DLIB_CASSERT(temp == "","");
DLIB_TEST(temp == "");
......
......@@ -97,34 +97,34 @@ namespace
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 9,"");
DLIB_TEST(temp == 9);
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 4,"");
DLIB_TEST(temp == 4);
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 2,"");
DLIB_TEST(temp == 2);
dlen.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
dlit.decode(temp);
DLIB_CASSERT(temp == 0,"");
DLIB_TEST(temp == 0);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -65,7 +65,7 @@ namespace
sm.wait();
DLIB_CASSERT(!failure,"");
DLIB_TEST(!failure);
}
void thread_end_handler (
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment