]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/test.qc
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / test.qc
index 15193fd41db338fddd48ba607fd8281bd6ce2ad4..3599819e7d02c5badc0fb262e5a97c69f6325257 100644 (file)
@@ -1,16 +1,25 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qc"
+       #include "test.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/dpextensions.qc"
+    #include "test.qh"
+#endif
+
 float TEST_failed;
 float TEST_ok;
 
 void TEST_Fail(string cond)
 {
-       print(sprintf("Assertion failed: ", cond));
+       printf("Assertion failed: ", cond);
        //backtrace();
        ++TEST_failed;
 }
 
 void TEST_OK()
 {
-       TEST_ok = TRUE;
+       TEST_ok = true;
 }
 
 float TEST_RunAll()
@@ -27,29 +36,29 @@ float TEST_RunAll()
        }
        if(f)
        {
-               print(sprintf("%d tests failed\n", f));
+               printf("%d tests failed\n", f);
                return 1;
        }
        else
        {
-               print(sprintf("All tests OK\n", f));
+               printf("All tests OK\n", f);
                return 0;
        }
 }
 
 float TEST_Run(string s)
 {
-       print(sprintf("%s: testing...\n", s));
+       printf("%s: testing...\n", s);
        TEST_failed = TEST_ok = 0;
        callfunction(strcat("_TEST_", s));
        if(TEST_failed > 0)
        {
-               print(sprintf("%s: %d items failed.\n", s, TEST_failed));
+               printf("%s: %d items failed.\n", s, TEST_failed);
                return 0;
        }
        else if(!TEST_ok)
        {
-               print(sprintf("%s: did not complete.\n", s));
+               printf("%s: did not complete.\n", s);
                return 0;
        }
        return 1;