xemu_perf_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
test_suite.h
1#ifndef XEMU_PERF_TESTS_TEST_SUITE_H
2#define XEMU_PERF_TESTS_TEST_SUITE_H
3
4#include <chrono>
5#include <functional>
6#include <map>
7#include <set>
8#include <string>
9#include <vector>
10
11#include "test_host.h"
12
16class TestSuite {
17 public:
19 struct Config {};
20
21 public:
22 TestSuite() = delete;
23 TestSuite(TestHost &host, std::string output_dir, std::string suite_name, const Config &config);
24 virtual ~TestSuite() = default;
25
26 [[nodiscard]] const std::string &Name() const { return suite_name_; };
27
29 virtual void Initialize();
30
32 virtual void Deinitialize() {}
33
35 virtual void SetupTest() {}
36
38 virtual void TearDownTest() {}
39
40 void DisableTests(const std::set<std::string> &tests_to_skip);
41
42 [[nodiscard]] std::vector<std::string> TestNames() const;
43 [[nodiscard]] bool HasEnabledTests() const { return !tests_.empty(); };
44
45 void Run(const std::string &test_name);
46
47 void RunAll();
48
49 protected:
51 TestHost::ProfileResults Profile(const std::string &test_name, uint32_t num_iterations,
52 const std::function<void(void)> &body) const;
53 void SetDefaultTextureFormat() const;
54
55 protected:
56 TestHost &host_;
57 std::string output_dir_;
58 std::string suite_name_;
59
60 // Map of `test_name` to `void test()`
61 std::map<std::string, std::function<void(void)>> tests_{};
62};
63
64#endif // XEMU_PERF_TESTS_TEST_SUITE_H
Definition test_host.h:12
Definition test_suite.h:16
virtual void Deinitialize()
Called to tear down the test suite.
Definition test_suite.h:32
virtual void Initialize()
Called to initialize the test suite.
Definition test_suite.cpp:78
virtual void TearDownTest()
Called after running an individual test within this suite.
Definition test_suite.h:38
TestHost::ProfileResults Profile(const std::string &test_name, uint32_t num_iterations, const std::function< void(void)> &body) const
Runs the given body function a number of times and calculates profiling information.
Definition test_suite.cpp:272
virtual void SetupTest()
Called before running an individual test within this suite.
Definition test_suite.h:35
Definition test_host.h:14
Runtime configuration for TestSuites.
Definition test_suite.h:19