]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #106 in SNORT/snort3 from jnc_time_profiler_unit_tests to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 29 Oct 2015 16:49:45 +0000 (12:49 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 29 Oct 2015 16:49:45 +0000 (12:49 -0400)
Squashed commit of the following:

commit f48e6eb9e352918b4d504cb9fe3e006a5bb16b25
Author: Joel Cornett <joel.cornett@gmail.com>
Date:   Thu Oct 29 12:40:41 2015 -0400

    updated profiler unit tests

src/time/profiler.cc

index 9a5ed2b9a74d0ec8b08bd827d7d16826f60dfb9d..92385ba3acb29eb892413bd90b9c72741586f0b1 100644 (file)
@@ -1153,8 +1153,7 @@ TEST_CASE( "mod stats node", "[profiler]" )
         ModStatsNode copied(node);
         auto copied_stats = copied.get_total();
 
-        CHECK( copied_stats.ticks == orig_stats.ticks );
-        CHECK( copied_stats.checks == orig_stats.checks );
+        CHECK( copied_stats == orig_stats );
     }
 
     SECTION( "accumulate() and get_total() correctly adds stats" )
@@ -1177,67 +1176,6 @@ TEST_CASE( "mod stats node", "[profiler]" )
         auto ps = node.get_total();
         CHECK_FALSE( ps );
     }
-
-    SECTION( "get_total() works correctly" )
-    {
-        ProfileStats a_stats = { 1, 3 };
-        ProfileStats b_stats = { 2, 4 };
-
-        MockProfilerModule a_mod(&a_stats);
-        MockProfilerModule b_mod(&b_stats);
-
-        ModStatsNode child("b");
-
-        node.set(&a_mod);
-        child.set(&b_mod);
-
-        node.add_child(&child);
-
-        node.accumulate();
-        child.accumulate();
-
-        SECTION( "A->get_total() calls B->get_total() and adds results only on the first call" )
-        {
-            ProfileStats expected = a_stats;
-            expected += b_stats;
-
-            auto ps = node.get_total();
-            CHECK( ps == expected );
-
-            ps = node.get_total();
-            CHECK( ps == expected );
-
-            SECTION( "child is totalled only once via call to parent" )
-            {
-                ProfileStats expected = b_stats;
-                auto ps = child.get_total();
-
-                CHECK( ps == expected );
-            }
-
-            SECTION( "reset forces totalling again for the current node" )
-            {
-                ProfileStats c_stats = { 7, 13 };
-                MockProfilerModule c_mod(&c_stats);
-                ModStatsNode second_child("c");
-
-                ProfileStats new_expected = expected;
-                new_expected += c_stats;
-
-                second_child.set(&c_mod);
-                second_child.accumulate();
-
-                node.add_child(&second_child);
-                REQUIRE( node.get_total() == expected );
-
-                node.reset();
-                node.accumulate();
-
-                auto ps = node.get_total();
-                CHECK( ps == new_expected );
-            }
-        }
-    }
 }
 
 TEST_CASE( "mod stats tree", "[profiler]" )