]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move test to /lib
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 26 Aug 2015 23:40:54 +0000 (09:40 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 26 Aug 2015 23:40:54 +0000 (09:40 +1000)
qcsrc/client/progs.src
qcsrc/common/command/generic.qc
qcsrc/common/test.qc [deleted file]
qcsrc/common/test.qh [deleted file]
qcsrc/lib/_all.inc
qcsrc/lib/test.qc [new file with mode: 0644]
qcsrc/lib/test.qh [new file with mode: 0644]
qcsrc/menu/menu.qh
qcsrc/menu/progs.src
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/progs.src

index 3c6ccc1c6fad124b2d20d8fc3a28f0663d4032ec..1b5471b94906c6c389768637951d627292cac650 100644 (file)
@@ -52,7 +52,6 @@ weapons/projectile.qc // TODO
 ../common/physics.qc
 ../common/playerstats.qc
 ../common/p2mathlib.qc
-../common/test.qc
 ../common/util.qc
 
 ../common/viewloc.qc
index d12cc064e5ca61a957c15750e0838b42418c6334..14bc58947a3660cf9e9d8448421559961766c142 100644 (file)
@@ -5,7 +5,6 @@
 #include "rpn.qh"
 
 #include "../mapinfo.qh"
-#include "../test.qh"
 
 #ifndef MENUQC
        #include "../notifications.qh"
diff --git a/qcsrc/common/test.qc b/qcsrc/common/test.qc
deleted file mode 100644 (file)
index 966553b..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#if defined(CSQC)
-       #include "../dpdefs/csprogsdefs.qh"
-       #include "test.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../dpdefs/dpextensions.qh"
-    #include "test.qh"
-#endif
-
-float TEST_failed;
-float TEST_ok;
-
-void TEST_Fail(string cond)
-{
-       printf("Assertion failed: ", cond);
-       //backtrace();
-       ++TEST_failed;
-}
-
-void TEST_OK()
-{
-       TEST_ok = true;
-}
-
-float TEST_RunAll()
-{
-       int f = 0;
-       float n = numentityfields();
-       for(int i = 0; i < n; ++i)
-       {
-               string name = entityfieldname(i);
-               if(substring(name, 0, 6) == "_TEST_")
-                       if(!TEST_Run(substring(name, 6, -1)))
-                               ++f;
-       }
-       if(f)
-       {
-               printf("%d tests failed\n", f);
-               return 1;
-       }
-       else
-       {
-               printf("All tests OK\n", f);
-               return 0;
-       }
-}
-
-float TEST_Run(string s)
-{
-       printf("%s: testing...\n", s);
-       TEST_failed = TEST_ok = 0;
-       callfunction(strcat("_TEST_", s));
-       if(TEST_failed > 0)
-       {
-               printf("%s: %d items failed.\n", s, TEST_failed);
-               return 0;
-       }
-       else if(!TEST_ok)
-       {
-               printf("%s: did not complete.\n", s);
-               return 0;
-       }
-       return 1;
-}
diff --git a/qcsrc/common/test.qh b/qcsrc/common/test.qh
deleted file mode 100644 (file)
index edc2f5b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef TEST_H
-#define TEST_H
-
-#define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0)
-
-void TEST_OK();
-void TEST_Fail(string cond);
-
-float TEST_RunAll();
-float TEST_Run(string test);
-#endif
index 1e7b85f489426b4181e7eb681120d93a57e08cf2..5a55b538b4baad5670b5965edc86157276e98354 100644 (file)
@@ -7,4 +7,5 @@
 #include "OO.qh"
 #include "Progname.qh"
 #include "Registry.qh"
+#include "test.qc"
 #include "urllib.qc"
diff --git a/qcsrc/lib/test.qc b/qcsrc/lib/test.qc
new file mode 100644 (file)
index 0000000..04f9f68
--- /dev/null
@@ -0,0 +1,57 @@
+#include "test.qh"
+
+float TEST_failed;
+float TEST_ok;
+
+void TEST_Fail(string cond)
+{
+       printf("Assertion failed: ", cond);
+       //backtrace();
+       ++TEST_failed;
+}
+
+void TEST_OK()
+{
+       TEST_ok = true;
+}
+
+float TEST_RunAll()
+{
+       int f = 0;
+       float n = numentityfields();
+       for(int i = 0; i < n; ++i)
+       {
+               string name = entityfieldname(i);
+               if(substring(name, 0, 6) == "_TEST_")
+                       if(!TEST_Run(substring(name, 6, -1)))
+                               ++f;
+       }
+       if(f)
+       {
+               printf("%d tests failed\n", f);
+               return 1;
+       }
+       else
+       {
+               printf("All tests OK\n", f);
+               return 0;
+       }
+}
+
+float TEST_Run(string s)
+{
+       printf("%s: testing...\n", s);
+       TEST_failed = TEST_ok = 0;
+       callfunction(strcat("_TEST_", s));
+       if(TEST_failed > 0)
+       {
+               printf("%s: %d items failed.\n", s, TEST_failed);
+               return 0;
+       }
+       else if(!TEST_ok)
+       {
+               printf("%s: did not complete.\n", s);
+               return 0;
+       }
+       return 1;
+}
diff --git a/qcsrc/lib/test.qh b/qcsrc/lib/test.qh
new file mode 100644 (file)
index 0000000..d1f5357
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef TEST_H
+#define TEST_H
+
+#include "../common/util.qh"
+
+#define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0)
+
+void TEST_OK();
+void TEST_Fail(string cond);
+
+float TEST_RunAll();
+float TEST_Run(string test);
+#endif
index 020a65a20c318ac1cf8f1bbf5e1625759aa30cc2..e4f594f71f68ad734a62beeda1aed79873506166 100644 (file)
@@ -9,7 +9,6 @@
 #include "xonotic/util.qh"
 
 #include "../common/constants.qh"
-#include "../common/test.qh"
 #include "../common/util.qh"
 
 #define localcmd cmd
index 4192c69917b45258fe2f222499d738c3f81c60ff..600e326a310c6442dd43de7e70c78e52b9e1f2fe 100644 (file)
@@ -20,7 +20,6 @@ xonotic/util.qc
 ../common/campaign_setup.qc
 ../common/mapinfo.qc
 ../common/playerstats.qc
-../common/test.qc
 ../common/util.qc
 
 ../common/items/all.qc
index a703fdc19b1074695e7735eb1047a100c55135d9..c5b1ce2ca9eba23e5d3cca696482667ffcb409be 100644 (file)
@@ -14,7 +14,6 @@
     #include "../../common/util.qh"
     #include "../../common/nades.qh"
     #include "../../common/buffs.qh"
-    #include "../../common/test.qh"
     #include "../../common/command/markup.qh"
     #include "../../common/command/rpn.qh"
     #include "../../common/command/generic.qh"
index 0cf64cae33df8648a60c8a3ea3028dd34f3d6ba0..61ec76196e1d9e4a038707368bedf0f3f2c3111e 100644 (file)
@@ -99,7 +99,6 @@ weapons/weaponsystem.qc
 ../common/physics.qc
 ../common/playerstats.qc
 ../common/p2mathlib.qc
-../common/test.qc
 ../common/viewloc.qc
 ../common/triggers/include.qc
 ../common/util.qc