-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTests.cpp
More file actions
52 lines (44 loc) · 1.21 KB
/
Tests.cpp
File metadata and controls
52 lines (44 loc) · 1.21 KB
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
42
43
44
45
46
47
48
49
50
51
52
#include "Base256uMath.h"
#include "UnitTests.h"
#ifdef __CUDACC__
#include "CUDAUnitTests.h"
#else
#include "PerformanceTests.h"
#endif
#include <iostream>
#include <string>
#ifndef MIN(a,b)
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX(a,b)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
constexpr std::size_t KB = 1024;
constexpr std::size_t MB = 1024 * KB;
constexpr std::size_t GB = 1024 * MB;
int main() {
#ifndef _DEBUG
std::cout << "Make sure you're in debug mode to perform tests!" << std::endl;
#endif
#ifdef BASE256UMATH_FAST_OPERATORS
std::cout << "FAST_OPERATORS enabled";
#ifdef __CUDACC__
std::cout << ", but some are disabled for CUDA";
#endif
std::cout << std::endl;
#endif
std::cout << "Running unit tests..." << std::endl;
Base256uMathTests::test_unit_tests();
#ifdef __CUDACC__
std::cout << "CUDA detected, running CUDA unit tests..." << std::endl;
Base256uMathTests::CUDA::test_unit_tests();
#endif
std::cout << "All unit tests passed." << std::endl;
#ifndef __CUDACC__
std::cout << std::endl;
std::cout << "Running performance tests..." << std::endl;
Base256uMathTests::Performance::test(100, 10 * KB);
std::cout << "Performance tests concluded." << std::endl;
#endif
return 0;
}