-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_node.c
39 lines (29 loc) · 1.41 KB
/
test_node.c
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
#include "test.h"
#include <engine/thorium/node.h>
#include <string.h>
int main(int argc, char **argv)
{
BEGIN_TESTS();
struct thorium_node node;
char buffer[1024];
strcpy(buffer, "0,1");
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 0), 0);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1), 1);
strcpy(buffer, "2,3,4,5");
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 2), 4);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 4), 2);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 5), 3);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 3), 5);
/* Knights Corner with host Xeon */
strcpy(buffer, "32,244");
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 0), 32);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1), 244);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 120), 32);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 121), 244);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1022), 32);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1023), 244);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1001022), 32);
TEST_INT_EQUALS(thorium_node_threads_from_string(&node, buffer, 1001023), 244);
END_TESTS();
return 0;
}