Commits

gyulalaszlo  committed 3edb317

added test temlate (still WIP)

  • Participants
  • Parent commits 6b1c60f

Comments (0)

Files changed (3)

File templates/test_group.template/test_group.cc

+#include "test_helpers.h"
+
+<%= generated_header %>
+
+namespace 
+{
+    struct <%= struct_name %> : public test::Group
+    {
+        <%= struct_name %>() : test::Group( "<%= struct_name %>") {}
+
+        virtual void describe()
+        {
+            test_case( <%= struct_name %> , truth );
+        }
+
+        
+        virtual void before_all()
+        {
+            // ...
+        }
+
+        virtual void after_all()
+        {
+            // ...
+        }
+
+        virtual void before_each()
+        {
+            memory_globals::init();
+        }
+
+        virtual void after_each()
+        {
+            // detect leaks
+            memory_globals::shutdown();
+        }
+
+        //////////////////////////////////////////////////////////////////////////
+
+        void truth()
+        {
+            ASSERT_EQ( 1, 1 );
+        }
+    };
+    
+    // Creating a static instance of this group registers it for running
+    static <%= struct_name %> <%= file_name %>;
+}

File templates/test_group.template/test_helpers.h.tt

+#include "test/testing.h"
+
+// Add any helper methods here

File templates/test_group.template/test_runner.cc.tt

+#include "test_helpers.h"
+
+
+// Run all the tests
+MKZ_RUN_TESTS_MAIN