forked from microsoft/GSL
Move from unittest-cpp to catch for unit testing. (#533)
Many thanks to @rianquinn. This should fix #495, #494 and #529.
This commit is contained in:
+18
-23
@@ -14,7 +14,7 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <UnitTest++/UnitTest++.h>
|
||||
#include <catch/catch.hpp>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
@@ -24,28 +24,23 @@
|
||||
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(owner_tests)
|
||||
void f(int* i) { *i += 1; }
|
||||
|
||||
TEST_CASE("basic_test")
|
||||
{
|
||||
void f(int* i) { *i += 1; }
|
||||
|
||||
TEST(basic_test)
|
||||
{
|
||||
owner<int*> p = new int(120);
|
||||
CHECK(*p == 120);
|
||||
f(p);
|
||||
CHECK(*p == 121);
|
||||
delete p;
|
||||
}
|
||||
|
||||
TEST(check_pointer_constraint)
|
||||
{
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
{
|
||||
owner<int> integerTest = 10;
|
||||
owner<std::shared_ptr<int>> sharedPtrTest(new int(10));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
owner<int*> p = new int(120);
|
||||
CHECK(*p == 120);
|
||||
f(p);
|
||||
CHECK(*p == 121);
|
||||
delete p;
|
||||
}
|
||||
|
||||
int main(int, const char* []) { return UnitTest::RunAllTests(); }
|
||||
TEST_CASE("check_pointer_constraint")
|
||||
{
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
{
|
||||
owner<int> integerTest = 10;
|
||||
owner<std::shared_ptr<int>> sharedPtrTest(new int(10));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user