blob: 2c42e04c1db17e3aeebb20f0dff4e1c9ab068baf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/**
** \file testsuite/libtestsuite.hh
** \brief Declare functions and variables exported by testsuite module.
*/
#pragma once
#include <ast/function-dec.hh>
namespace testsuite
{
/**
* Find all the tests functions of a program and return references to each of
* them.
*
* A function is considered a test function if it has the following
* properties :\n
* - It is located at the first level of a program file\n
* - Its name starts with test_*
*
* @param program the program to analyse
* @return a vector containing a reference to each test function
*/
std::vector<const ast::FunctionDec*>
find_program_tests(const ast::ChunkList& program);
/**
* Create a testsuite runtime, which runs each function referenced in the
* vector.
*
* The return tree may then be appended to the main program AST list to be
* compiled along with the rest of this latter.
*
* @param tests the tests to run
* @return an AST tree describing the resulting testsuite runtime
*/
ast::ChunkInterface*
create_testsuite_runtime(const std::vector<const ast::FunctionDec*>& tests);
} // namespace testsuite
|