From 53fcbd8422fcc772c18d94494fdcf46776d44853 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Fri, 24 Mar 2017 09:10:19 +0100 Subject: [PATCH] another test for alib Object --- alib2common/test-src/object/ObjectTest.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/alib2common/test-src/object/ObjectTest.cpp b/alib2common/test-src/object/ObjectTest.cpp index d3883de7d1..9849f8d4e7 100644 --- a/alib2common/test-src/object/ObjectTest.cpp +++ b/alib2common/test-src/object/ObjectTest.cpp @@ -5,10 +5,7 @@ #include "sax/SaxComposeInterface.h" #include "object/Object.h" -#include "container/ObjectsPair.h" -#include <primitive/Character.h> - -#include "factory/XmlDataFactory.hpp" +#include <primitive/Unsigned.h> #include <type_traits> @@ -23,4 +20,14 @@ void ObjectTest::tearDown ( ) { void ObjectTest::testProperties ( ) { CPPUNIT_ASSERT ( std::is_nothrow_move_constructible < alib::Object >::value ); + CPPUNIT_ASSERT ( std::is_move_constructible < alib::Object >::value && std::is_move_assignable < alib::Object >::value ); + + alib::Object tmp1 { primitive::Unsigned ( 1 ) }; + alib::Object tmp2 { primitive::Unsigned ( 2 ) }; + + std::swap ( tmp1, tmp2 ); + + CPPUNIT_ASSERT ( tmp1 == alib::Object ( primitive::Unsigned ( 2 ) ) ); + CPPUNIT_ASSERT ( tmp2 == alib::Object ( primitive::Unsigned ( 1 ) ) ); + } -- GitLab