Xonotic
test.qc File Reference
#include "test.qh"
+ Include dependency graph for test.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool RUN_ALL_TESTS ()
 
bool TEST_Run (string s)
 
int TEST_RunAll_accumulated (int init)
 

Function Documentation

◆ RUN_ALL_TESTS()

bool RUN_ALL_TESTS ( )

Definition at line 4 of file test.qc.

References LOG_INFO, LOG_INFOF, and TEST_RunAll_accumulated().

Referenced by GenericCommand_runtest().

5 {
6  int f = TEST_RunAll_accumulated(0);
7  if (f)
8  {
9  LOG_INFOF("%d tests failed", f);
10  return true;
11  }
12  else
13  {
14  LOG_INFO("All tests OK");
15  return false;
16  }
17 }
int TEST_RunAll_accumulated(int init)
#define LOG_INFOF(...)
Definition: log.qh:71
#define LOG_INFO(...)
Definition: log.qh:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TEST_Run()

bool TEST_Run ( string  s)

Definition at line 19 of file test.qc.

References callfunction(), isfunction(), LOG_INFOF, strcat(), TEST_failed, TEST_fatal, and TEST_ok.

Referenced by GenericCommand_runtest().

20 {
21  LOG_INFOF("%s: testing...", s);
22  TEST_failed = 0;
23  TEST_fatal = 0;
24  TEST_ok = false;
25  string fn = strcat("_TEST_", s);
26  if (isfunction(fn)) callfunction(fn);
27  if (TEST_failed > 0)
28  {
29  LOG_INFOF("%s: %d items failed.", s, TEST_failed);
30  return false;
31  }
32  else if (!TEST_ok)
33  {
34  LOG_INFOF("%s: did not complete.", s);
35  return false;
36  }
37  return true;
38 }
#define LOG_INFOF(...)
Definition: log.qh:71
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
int TEST_failed
Definition: test.qh:75
int TEST_fatal
Definition: test.qh:73
bool TEST_ok
Definition: test.qh:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TEST_RunAll_accumulated()

int TEST_RunAll_accumulated ( int  init)

Referenced by RUN_ALL_TESTS().

+ Here is the caller graph for this function: