cpp : Moved unit test to seperate files

This commit is contained in:
saundersp
2023-07-24 02:20:26 +02:00
parent c048b3ca90
commit 598fdc383c
8 changed files with 336 additions and 142 deletions

View File

@ -3,12 +3,12 @@ namespace fs = std::filesystem;
#include "data.hpp"
#include "toolbox.hpp"
#include "config.hpp"
#include "gpu_unit_test.hpp"
#include "toolbox_unit_test.hpp"
#include "ViolaJones.hpp"
#include "ViolaJonesGPU.hpp"
#include "ViolaJonesCPU.hpp"
void test_float() noexcept;
#if GPU_BOOSTED
#define LABEL "GPU"
#define apply_features apply_features_gpu
@ -290,17 +290,21 @@ void final_unit_test() {
}
int main(){
#if __DEBUG
setlocale(LC_NUMERIC, ""); // Allow proper number display
printf("| %-49s | %-18s | %-29s |\n", "Unit testing", "Time spent (ns)", "Formatted time spent");
printf("|%s|%s|%s|\n", S(51), S(20), S(31));
#if GPU_BOOSTED
benchmark_function_void("Testing GPU capabilities 1D", test_working, 3 + (1<<29));
benchmark_function_void("Testing GPU capabilities 2D", test_working_2d, 3 + (1<<15), 2 + (1<<14));
benchmark_function_void("Testing GPU capabilities 3D", test_working_3d, 9 + (1<<10), 5 + (1<<10), 7 + (1<<9));
benchmark_function_void("Testing toolbox", toolbox_unit_test);
// benchmark_function_void("Testing floating capabilities", test_float);
printf("\n");
#endif
setlocale(LC_NUMERIC, ""); // Allow proper number display
benchmark_function_void("Testing format_time", format_time_test);
benchmark_function_void("Testing format_time_ns", format_time_ns_test);
benchmark_function_void("Testing format_byte_size", format_byte_size_test);
benchmark_function_void("Testing thousand_sep", thousand_sep_test);
printf("\n");
const auto [ X_train_feat, X_train_feat_argsort, y_train, X_test_feat, y_test ] = preprocessing();
train(X_train_feat, X_train_feat_argsort, y_train);
testing_and_evaluating(X_train_feat, y_train, X_test_feat, y_test);