| 1 | // Copyright 2009-2021 Intel Corporation | 
|---|---|
| 2 | // SPDX-License-Identifier: Apache-2.0 | 
| 3 | |
| 4 | #include "regression.h" | 
| 5 | |
| 6 | namespace embree | 
| 7 | { | 
| 8 | /* registerRegressionTest is invoked from static initializers, thus | 
| 9 | * we cannot have the regression_tests variable as global static | 
| 10 | * variable due to issues with static variable initialization | 
| 11 | * order. */ | 
| 12 | std::vector<RegressionTest*>& get_regression_tests() | 
| 13 | { | 
| 14 | static std::vector<RegressionTest*> regression_tests; | 
| 15 | return regression_tests; | 
| 16 | } | 
| 17 | |
| 18 | void registerRegressionTest(RegressionTest* test) | 
| 19 | { | 
| 20 | get_regression_tests().push_back(x: test); | 
| 21 | } | 
| 22 | |
| 23 | RegressionTest* getRegressionTest(size_t index) | 
| 24 | { | 
| 25 | if (index >= get_regression_tests().size()) | 
| 26 | return nullptr; | 
| 27 | |
| 28 | return get_regression_tests()[index]; | 
| 29 | } | 
| 30 | } | 
| 31 | 
