-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_machine.cpp
113 lines (61 loc) · 2.02 KB
/
test_machine.cpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "catch.hpp"
#include "compass_fixture.hpp"
#include "compass.hpp"
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
TEST_CASE_METHOD( host_reference, "machine_specific" ){
SECTION( "vendor_right" ){
auto value = compass::runtime::vendor();
REQUIRE(value.size()!=0u);
std::transform(value.begin(), value.end(),
value.begin(),
::tolower);
REQUIRE(value.find(expected_vendor)!=std::string::npos);
}
SECTION( "brand_right" ){
auto value = compass::runtime::brand();
REQUIRE(value.empty()!=true);
REQUIRE_THAT(value, Catch::Matchers::Contains(expected_brand) );
}
SECTION( "device_name_right" ){
auto value = compass::runtime::device_name();
REQUIRE(value.empty()!=true);
REQUIRE_THAT(value, Catch::Matchers::Contains(expected_device_name) );
}
SECTION( "ncores_right" ){
auto value = compass::runtime::threads();
REQUIRE(value!=0);
REQUIRE(value==expected_ncores);
}
// SECTION( "physical_cores_right" ){
// auto value = compass::runtime::physical_threads();
// REQUIRE(value!=0);
// REQUIRE(value==expected_nphyscores);
// }
SECTION( "has_sse_right" ){
auto value = compass::runtime::has(compass::feature::sse());
REQUIRE(value==expected_has_sse);
}
SECTION( "has_sse2_right" ){
auto value = compass::runtime::has(compass::feature::sse2());
REQUIRE(value==expected_has_sse2);
}
SECTION( "has_sse3_right" ){
auto value = compass::runtime::has(compass::feature::sse3());
REQUIRE(value==expected_has_sse3);
}
SECTION( "has_sse4_right" ){
auto value = compass::runtime::has(compass::feature::sse4());
REQUIRE(value==expected_has_sse4);
}
SECTION( "has_avx_right" ){
auto value = compass::runtime::has(compass::feature::avx());
REQUIRE(value==expected_has_avx);
}
SECTION( "has_avx2_right" ){
auto value = compass::runtime::has(compass::feature::avx2());
REQUIRE(value==expected_has_avx2);
}
}