1 #ifndef __TestSuite_H__
2 #define __TestSuite_H__
5 #include <TThreadDynarray.h>
8 * Declaration of the s_TestSuite, which represents
11 typedef struct s_TestSuite
13 TestCaseContext_t test_case_context; /* the context of the current test case */
14 Stream_t stream; /* stdin or file stream */
15 size_t testCaseCount; /* test case count */
16 size_t successCount; /* test case success count */
17 size_t failureCount; /* test case failure count */
19 char currentTime[30]; /* the current time */
20 #endif /* #ifdef __VERBOSE */
21 ThreadDynarray_t threads;
22 }s_TestSuite_t,* TestSuite_t;
25 * s_TestSuite connected functions.
29 * Create a new s_TestSuite an returns a pointer to self.
31 TestSuite_t TestSuite_new(void);
34 * Free the s_TestSuite pointed to by ptr.
36 void TestSuite_free(TestSuite_t ptr);
39 * Initialize the s_TestSuite structure.
41 errno_t TestSuite_initialize(TestSuite_t ptr,int argc,char *argv[]);
45 * This function reads an entire line, storing
46 * the address of the buffer containing the text into
47 * s_TestSuite.current_line.
49 ssize_t TestSuite_getline(TestSuite_t ptr,size_t* len);
52 * Launch the test suite.
54 void TestSuite_run(TestSuite_t ptr);
57 * Meta command processing.
59 errno_t TestSuite_processMetaCommand(TestSuite_t testSuite);
62 * Set the timeout of the test case context of the
65 void TestSuite_setTimeout(TestSuite_t testSuite);
68 * Enable output checking for the current test case context.
70 void TestSuite_enableOutputChecking(TestSuite_t testSuite);
73 * Disable output checking for the current test case context.
75 void TestSuite_disableOutputChecking(TestSuite_t testSuite);
78 * Enable post output checking for the current test case context.
80 void TestSuite_enablePostOutputChecking(TestSuite_t testSuite);
83 * Disable post output checking for the current test case context.
85 void TestSuite_disablePostOutputChecking(TestSuite_t testSuite);
88 * Set the expected exit code of the current test case context of the test suite.
90 void TestSuite_setExpectedExitCode(TestSuite_t testSuite);
93 * Export a variable in the environment of the current test_runner.exe process.
95 errno_t TestSuite_export(TestSuite_t testSuite);
98 * Expected child output processing.
100 errno_t TestSuite_processExpectedChildOutput(TestSuite_t testSuite);
103 * Child input processing.
105 errno_t TestSuite_processChildInput(TestSuite_t testSuite);
108 * Check the child output.
110 errno_t TestSuite_checkChildOutput(TestCaseContext_t context);
115 void TestSuite_print(const char* str);
118 * Check the child process exit code.
120 errno_t TestSuite_checkChildExitCode(TestCaseContext_t context);
122 errno_t TestSuite_unset(TestSuite_t testSuite);
124 void TestSuite_createConsole(TestSuite_t testSuite);
126 void TestSuite_createNoConsole(TestSuite_t testSuite);
128 void TestSuite_enableExitCodeChecking(TestSuite_t testSuite);
130 void TestSuite_disableExitCodeChecking(TestSuite_t testSuite);
132 unsigned long WINAPI TestSuite_runSyncTestCase(void* param);
134 errno_t TestSuite_runAsyncTestCase(TestSuite_t testSuite);
137 * Terminate the test suite.
139 void TestSuite_terminate(TestSuite_t testSuite);
141 unsigned long WINAPI TestSuite_asyncReadChildOutput(void* param);
143 bool TestSuite_iSPostOutputCheckingEnabled(TestCaseContext_t context);
145 bool TestSuite_iSExitCodeCheckingEnabled(TestCaseContext_t context);
147 errno_t TestSuite_changeDir(TestSuite_t testSuite);
149 void TestSuite_setCommandLine(TestSuite_t testSuite);
154 * Update the current time.
156 void TestSuite_update_current_time(TestSuite_t ptr);
157 #endif /* #ifdef __VERBOSE */
161 #endif /* #ifndef __TestSuite_H__ */