Sparse Virtual File System  0.4.0
A Sparse Virtual File System.
test_cpp_svfs.cpp
Go to the documentation of this file.
1 
32 #include "test_svf.h"
33 #include "cpp_svfs.h"
34 
35 namespace SVFS {
36  namespace Test {
37 
39  std::string test_name(__FUNCTION__);
40  int result = 0; // Success
41  TestCount count;
42 
43  auto time_start = std::chrono::high_resolution_clock::now();
44  std::string version = SVFS_CPP_VERSION;
45  result |= version != "0.4.0";
46  std::chrono::duration<double> time_exec = std::chrono::high_resolution_clock::now() - time_start;
47  TestResult test_result = TestResult(__PRETTY_FUNCTION__, test_name, result, "", time_exec.count(), 1);
48  results.push_back(test_result);
49  count.add_result(test_result.result());
50  return count;
51  }
52 
54  std::string test_name(__FUNCTION__);
55  int result = 0; // Success
56  TestCount count;
57 
58  auto time_start = std::chrono::high_resolution_clock::now();
59  result |= SVFS_CPP_VERSION_MAJOR != 0;
60  std::chrono::duration<double> time_exec = std::chrono::high_resolution_clock::now() - time_start;
61  TestResult test_result = TestResult(__PRETTY_FUNCTION__, test_name, result, "", time_exec.count(), 1);
62  results.push_back(test_result);
63  count.add_result(test_result.result());
64  return count;
65  }
66 
68  std::string test_name(__FUNCTION__);
69  int result = 0; // Success
70  TestCount count;
71 
72  auto time_start = std::chrono::high_resolution_clock::now();
73  result |= SVFS_CPP_VERSION_MINOR != 4;
74  std::chrono::duration<double> time_exec = std::chrono::high_resolution_clock::now() - time_start;
75  TestResult test_result = TestResult(__PRETTY_FUNCTION__, test_name, result, "", time_exec.count(), 1);
76  results.push_back(test_result);
77  count.add_result(test_result.result());
78  return count;
79  }
80 
82  std::string test_name(__FUNCTION__);
83  int result = 0; // Success
84  TestCount count;
85 
86  auto time_start = std::chrono::high_resolution_clock::now();
87  result |= SVFS_CPP_VERSION_PATCH != 0;
88  std::chrono::duration<double> time_exec = std::chrono::high_resolution_clock::now() - time_start;
89  TestResult test_result = TestResult(__PRETTY_FUNCTION__, test_name, result, "", time_exec.count(), 1);
90  results.push_back(test_result);
91  count.add_result(test_result.result());
92  return count;
93  }
94 
96  std::string test_name(__FUNCTION__);
97  int result = 0; // Success
98  TestCount count;
99 
100  auto time_start = std::chrono::high_resolution_clock::now();
101  result |= std::string(SVFS_CPP_VERSION_SUFFIX) != "rc0";
102  std::chrono::duration<double> time_exec = std::chrono::high_resolution_clock::now() - time_start;
103  TestResult test_result = TestResult(__PRETTY_FUNCTION__, test_name, result, "", time_exec.count(), 1);
104  results.push_back(test_result);
105  count.add_result(test_result.result());
106  return count;
107  }
108 
110  TestCount count;
111  count += test_cpp_version(results);
112  count += test_cpp_version_major(results);
113  count += test_cpp_version_minor(results);
114  count += test_cpp_version_patch(results);
115  count += test_cpp_version_suffix(results);
116  return count;
117  }
118 
119  } // namespace Test
120 } // namespace SVFS
Count of tests taht pass and fail.
Definition: test.h:137
void add_result(int result)
Add a tests result.
Definition: test.h:148
Result of a test.
Definition: test.h:68
int result() const
Definition: test.h:92
const char * SVFS_CPP_VERSION_SUFFIX
Version suffix string, could be "rc2" for example.
Definition: cpp_svfs.cpp:44
int SVFS_CPP_VERSION_PATCH
Patch version number.
Definition: cpp_svfs.cpp:42
int SVFS_CPP_VERSION_MINOR
Minor version number.
Definition: cpp_svfs.cpp:40
int SVFS_CPP_VERSION_MAJOR
Major version number.
Definition: cpp_svfs.cpp:38
const char * SVFS_CPP_VERSION
The version as a string.
Definition: cpp_svfs.cpp:35
TestCount test_cpp_version_suffix(t_test_results &results)
std::vector< TestResult > t_test_results
Definition: test.h:128
TestCount test_cpp_version_minor(t_test_results &results)
TestCount test_cpp_version_patch(t_test_results &results)
TestCount test_cpp_svfs_all(t_test_results &results)
TestCount test_cpp_version_major(t_test_results &results)
TestCount test_cpp_version(t_test_results &results)
The namespace for all svfsc code.
Definition: svf.cpp:41