-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_unittests.cu
116 lines (94 loc) · 3.48 KB
/
test_unittests.cu
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
114
115
116
// ----------------------------------------------------------------
// Gunrock -- Fast and Efficient GPU Graph Library
// ----------------------------------------------------------------
// This source code is distributed under the terms of LICENSE.TXT
// in the root directory of this source distribution.
// ----------------------------------------------------------------
/**
* @file
* test_unitests.cu
*
* @brief Main test driver for all googletests.
* @source
* https://github.com/google/googletest/blob/master/googletest/docs/Primer.md
*/
#include <stdio.h>
#include <gunrock/gunrock.h>
#include <gunrock/app/hello/hello_app.cu>
#include <gunrock/app/test_base.cuh>
#include <gtest/gtest.h>
/**
* @brief: Gunrock: Google tests -- list of tests
* found in this directory, testing core functionality
* of gunrock: primitives, operators, device intrinsics,
* etc.
*
*/
// bug:: malloc_consolidate(): invalid chunk size
//#include "test_lib_pr.h"
// Tests Subgraph Matching
#include "test_lib_sm.h"
// Tests the RepeatFor Operator
#include "test_repeatfor.h"
// Tests Segmented Reduction (device)
#include "test_segreduce.h"
// Tests Binary Search
#include "test_binarysearch.h"
#include "test_pointer_location.h"
using namespace gunrock;
cudaError_t UseParameters(util::Parameters ¶meters) {
cudaError_t retval = cudaSuccess;
GUARD_CU(parameters.Use<bool>("googletest", util::OPTIONAL_PARAMETER, true,
"Example parameter for googletest", __FILE__,
__LINE__));
return retval;
}
/******************************************************************************
* Main
******************************************************************************/
/**
* @brief Enclosure to the main function
*/
struct main_struct {
/**
* @brief the actual main function, after type switching
* @tparam VertexT Type of vertex identifier
* @tparam SizeT Type of graph size, i.e. type of edge identifier
* @tparam ValueT Type of edge values
* @param parameters Command line parameters
* @param v,s,val Place holders for type deduction
* \return cudaError_t error message(s), if any
*/
template <typename VertexT, // Use int as the vertex identifier
typename SizeT, // Use int as the graph size type
typename ValueT> // Use int as the value type
cudaError_t
operator()(util::Parameters ¶meters, VertexT v, SizeT s, ValueT val) {
// CLI parameters
bool quick = parameters.Get<bool>("quick");
bool quiet = parameters.Get<bool>("quiet");
cudaError_t retval = cudaSuccess;
return retval;
}
};
int main(int argc, char **argv) {
cudaError_t retval = cudaSuccess;
util::Parameters parameters("test unittests");
GUARD_CU(graphio::UseParameters(parameters));
GUARD_CU(app::UseParameters_test(parameters));
GUARD_CU(UseParameters(parameters));
GUARD_CU(parameters.Parse_CommandLine(argc, argv));
if (parameters.Get<bool>("help")) {
parameters.Print_Help();
return cudaSuccess;
}
// Run all tests using the google tests
// framework.
::testing::InitGoogleTest(&argc, argv);
RUN_ALL_TESTS();
return app::Switch_Types<app::VERTEXT_U32B | app::VERTEXT_U64B |
app::SIZET_U32B | // app::SIZET_U64B |
app::VALUET_F32B | // app::VALUET_F64B |
app::DIRECTED | app::UNDIRECTED>(parameters,
main_struct());
}