tests: add sstring tests

This commit is contained in:
Tomasz Grabiec
2014-10-09 15:45:26 +02:00
parent 5f3352b7e3
commit da10ab6443
2 changed files with 21 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ tests = [
'tests/udp_server',
'tests/udp_client',
'tests/blkdiscard_test',
'tests/sstring_test',
]
apps = [
@@ -57,6 +58,7 @@ deps = {
'tests/udp_server': ['tests/udp_server.cc'] + core + libnet,
'tests/udp_client': ['tests/udp_client.cc'] + core + libnet,
'tests/blkdiscard_test': ['tests/blkdiscard_test.cc'] + core,
'tests/sstring_test': ['tests/sstring_test.cc'] + core,
}
modes = {
@@ -139,9 +141,9 @@ def debug_flag(compiler):
src_with_auto = textwrap.dedent('''\
template <typename T>
struct x { auto f() {} };
x<int> a;
''')
''')
if try_compile(source = src_with_auto, flags = ['-g', '-std=gnu++1y'], compiler = compiler):
return '-g'
else:

17
tests/sstring_test.cc Normal file
View File

@@ -0,0 +1,17 @@
/*
* Copyright 2014 Cloudius Systems
*/
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE core
#include <boost/test/included/unit_test.hpp>
#include "core/sstring.hh"
BOOST_AUTO_TEST_CASE(test_equality) {
BOOST_REQUIRE_EQUAL(sstring("aaa"), sstring("aaa"));
}
BOOST_AUTO_TEST_CASE(test_to_sstring) {
BOOST_REQUIRE_EQUAL(to_sstring(1234567), sstring("1234567"));
}