Skip to content
Snippets Groups Projects
Commit c7d4c99d authored by Jan Trávníček's avatar Jan Trávníček
Browse files

Test for Tom

parent abe38472
No related branches found
No related tags found
No related merge requests found
......@@ -55,3 +55,7 @@ doc/*
**/test-obj-debug
 
**/CppUnitTestResults.xml
debug.sh
release.sh
#include "VariantTest.h"
#include <variant>
#include <set>
#include <algorithm>
 
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VariantTest, "bits" );
CPPUNIT_TEST_SUITE_REGISTRATION( VariantTest );
......@@ -97,3 +98,13 @@ void VariantTest::testVariantSet() {
CPPUNIT_ASSERT( testMap.find(std::variant<std::string, int> {"aa"}) != testMap.end() );
CPPUNIT_ASSERT( testMap.find(std::variant<std::string, int> {10}) == testMap.end() );
}
void VariantTest::testVariantSet2() {
std::set<std::variant<std::string, int>> s, t, u;
s.insert(std::string { "aa" } );
s.insert(123);
std::set_union(s.begin(), s.end(), t.begin(), t.end(), std::inserter(u, u.begin()));
CPPUNIT_ASSERT( s.size() == u.size());
}
......@@ -9,6 +9,7 @@ class VariantTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE( VariantTest );
CPPUNIT_TEST( testVariant );
CPPUNIT_TEST( testVariantSet );
CPPUNIT_TEST( testVariantSet2 );
CPPUNIT_TEST_SUITE_END();
 
public:
......@@ -66,6 +67,7 @@ public:
 
void testVariant();
void testVariantSet();
void testVariantSet2();
};
 
namespace std {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment