Permalink
Browse files

use gtest fused source

  • Loading branch information...
1 parent 73068a8 commit a519391cd1aa5baf2412ee7ca471e3d14dd64bfa @Constellation committed May 4, 2012
View
31 SConstruct
@@ -10,24 +10,33 @@ from GenerateFile import TOOL_SUBST
def GetVariables():
return Variables()
-def Test(context):
+def GTestLib(context):
+ return context.SConscript(
+ join(root_dir, 'test', 'gtest', 'SConscript'),
+ variant_dir=join(root_dir, 'obj', 'test', 'gtest'),
+ src=join(root_dir, 'iv', 'test', 'gtest'),
+ duplicate=False,
+ exports="context root_dir"
+ )
+
+def Test(context, gtest):
test_task = context.SConscript(
'test/SConscript',
variant_dir=join(root_dir, 'obj', 'test'),
src=join(root_dir, 'test'),
duplicate=False,
- exports="context"
+ exports="context root_dir gtest"
)
context.AlwaysBuild(test_task)
return test_task
-def TestLv5(context, object_files, libs):
+def TestLv5(context, gtest, object_files, libs):
test_task = context.SConscript(
'test/lv5/SConscript',
variant_dir=join(root_dir, 'obj', 'test', 'lv5'),
src=join(root_dir, 'test', 'lv5'),
duplicate=False,
- exports="context libs object_files"
+ exports="context root_dir libs object_files gtest"
)
context.AlwaysBuild(test_task)
return test_task
@@ -42,15 +51,6 @@ def Lv5(context):
)
return lv5_task, lv5_objs, lv5_libs
-def Main(context, deps):
- return context.SConscript(
- 'iv/SConscript',
- variant_dir=join(root_dir, 'obj', 'iv'),
- src=join(root_dir, 'iv'),
- duplicate=False,
- exports='root_dir context deps'
- )
-
def Build():
options = {}
var = GetVariables()
@@ -159,8 +159,9 @@ def Build():
lv5_prog, lv5_objs, lv5_libs = Lv5(env)
env.Alias('lv5', [lv5_prog])
- test_prog = Test(env)
- test_lv5_prog = TestLv5(env, lv5_objs, lv5_libs)
+ gtest = GTestLib(env)
+ test_prog = Test(env, gtest)
+ test_lv5_prog = TestLv5(env, gtest, lv5_objs, lv5_libs)
test_alias = env.Alias('test', test_prog, test_prog[0].abspath)
test_lv5_alias = env.Alias('testlv5', test_lv5_prog, test_lv5_prog[0].abspath)
env.Default('lv5')
View
7 test/SConscript
@@ -1,11 +1,12 @@
-Import('context')
+from os.path import join, dirname, abspath
+Import('context root_dir gtest')
def Build():
conf = Configure(context.Clone())
conf.CheckLib('pthread')
- conf.CheckLib(library='gtest', language='cxx')
env = conf.Finish()
- return env.Program('cctest', Glob('*.cc'))
+ env.Append(CPPPATH=[join(root_dir, 'test')])
+ return env.Program('cctest', [Glob('*.cc'), gtest])
program = Build()
Return('program')
View
10 test/gtest/SConscript
@@ -0,0 +1,10 @@
+from os.path import join, dirname, abspath
+Import('context root_dir')
+
+def Build():
+ env = context.Clone()
+ env.Append(CPPPATH=[join(root_dir, 'test')])
+ return env.StaticLibrary('gtest', 'gtest-all.cc')
+
+program = Build()
+Return('program')
View
9,118 test/gtest/gtest-all.cc
9,118 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
19,537 test/gtest/gtest.h
19,537 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
7 test/lv5/SConscript
@@ -1,15 +1,16 @@
-Import('context libs object_files')
+from os.path import join, dirname, abspath
+Import('context root_dir libs object_files gtest')
def Build():
conf = Configure(context.Clone())
conf.CheckLib('pthread')
- conf.CheckLib(library='gtest', language='cxx')
env = conf.Finish()
env.Append(
LIBS=libs,
CCFLAGS=["-fno-strict-aliasing"],
CPPDEFINES=["__STDC_FORMAT_MACROS"])
- return env.Program('cctest', [Glob('*.cc'), object_files])
+ env.Append(CPPPATH=[join(root_dir, 'test')])
+ return env.Program('cctest', [Glob('*.cc'), gtest, object_files])
program = Build()
Return('program')
View
6 test/lv5/test_radio_arena.cc
@@ -7,6 +7,8 @@ TEST(RadioArenaCase, ArenaBlocksTest) {
// check blocks size and iterator / const_iterator behavior
iv::core::ScopedPtr<iv::lv5::radio::Arena> arena(new iv::lv5::radio::Arena(NULL));
- EXPECT_EQ(iv::lv5::radio::kBlocks, std::distance(arena->begin(), arena->end()));
- EXPECT_EQ(iv::lv5::radio::kBlocks, std::distance(arena->cbegin(), arena->cend()));
+ EXPECT_EQ(iv::lv5::radio::kBlocks,
+ static_cast<std::size_t>(std::distance(arena->begin(), arena->end())));
+ EXPECT_EQ(iv::lv5::radio::kBlocks,
+ static_cast<std::size_t>(std::distance(arena->cbegin(), arena->cend())));
}
View
2 test/test_aero_vm.cc
@@ -356,7 +356,7 @@ TEST(AeroVMCase, CaptureTest) {
// disasm.DisAssemble(code);
ASSERT_TRUE(vm.Execute(code.get(), str1, vec.data(), 0));
EXPECT_EQ(0, vec[0]);
- EXPECT_EQ(str1.size(), vec[1]);
+ EXPECT_EQ(str1.size(), static_cast<std::size_t>(vec[1]));
EXPECT_EQ(0, vec[2]);
EXPECT_EQ(5, vec[3]);
}
View
4 test/test_assoc_vector.cc
@@ -5,10 +5,10 @@
TEST(AssocVectorCase, MainTest) {
iv::core::AssocVector<int, int> sorted;
sorted.insert(std::make_pair(10, 20));
- EXPECT_EQ(1, sorted.size());
+ EXPECT_EQ(1u, sorted.size());
EXPECT_EQ(20, sorted[10]);
sorted.erase(10);
- EXPECT_EQ(0, sorted.size());
+ EXPECT_EQ(0u, sorted.size());
EXPECT_TRUE(sorted.end() == sorted.find(10));
sorted[10] = 20;
EXPECT_EQ(20, sorted[10]);
View
16 test/test_character.cc
@@ -16,16 +16,16 @@ TEST(CharacterCase, ToUpperCaseTest) {
target = 'A'; ch <= 'z'; ++ch, ++target) {
ASSERT_EQ(ToUpperCase(ch), target);
}
- ASSERT_EQ(0x00CB, ToUpperCase(0x00EB));
- ASSERT_EQ(0x0531, ToUpperCase(0x0561));
- ASSERT_EQ('A', ToUpperCase('A'));
- ASSERT_EQ(0x0560, ToUpperCase(0x0560));
+ ASSERT_EQ(0x00CBu, ToUpperCase(0x00EB));
+ ASSERT_EQ(0x0531u, ToUpperCase(0x0561));
+ ASSERT_EQ(static_cast<uint16_t>('A'), ToUpperCase('A'));
+ ASSERT_EQ(0x0560u, ToUpperCase(0x0560));
for (uint32_t ch = 0; ch < 0x10000; ++ch) {
ToUpperCase(ch);
}
- ASSERT_EQ(0x00530053, ToUpperCase(0x00DF));
- ASSERT_EQ(0x00460046, ToUpperCase(0xFB00));
+ ASSERT_EQ(0x00530053u, ToUpperCase(0x00DF));
+ ASSERT_EQ(0x00460046u, ToUpperCase(0xFB00));
}
TEST(CharacterCase, ToLowerCaseTest) {
@@ -35,8 +35,8 @@ TEST(CharacterCase, ToLowerCaseTest) {
target = 'a'; ch <= 'A'; ++ch, ++target) {
ASSERT_EQ(ToLowerCase(ch), target);
}
- ASSERT_EQ(0x0561, ToLowerCase(0x0531));
- ASSERT_EQ(0x0560, ToLowerCase(0x0560));
+ ASSERT_EQ(0x0561u, ToLowerCase(0x0531));
+ ASSERT_EQ(0x0560u, ToLowerCase(0x0560));
for (uint32_t ch = 0; ch < 0x10000; ++ch) {
ToLowerCase(ch);
View
8 test/test_conversions.cc
@@ -275,16 +275,16 @@ TEST(ConversionsCase, ConvertToUInt32) {
ASSERT_FALSE(ConvertToUInt32("20e", &target));
ASSERT_TRUE(ConvertToUInt32("0", &target));
- ASSERT_EQ(0, target);
+ ASSERT_EQ(0u, target);
ASSERT_TRUE(ConvertToUInt32("1", &target));
- ASSERT_EQ(1, target);
+ ASSERT_EQ(1u, target);
ASSERT_TRUE(ConvertToUInt32("10", &target));
- ASSERT_EQ(10, target);
+ ASSERT_EQ(10u, target);
ASSERT_TRUE(ConvertToUInt32("1000", &target));
- ASSERT_EQ(1000, target);
+ ASSERT_EQ(1000u, target);
ASSERT_FALSE(ConvertToUInt32("0100", &target));
View
6 test/test_dtoa.cc
@@ -33,7 +33,7 @@ TEST(DToACase, DToAGayFixed) {
std::fill(buffer.begin(), buffer.end(), '\0');
const PrecomputedFixed current_test = *it;
double v = current_test.v;
- const int number_digits = current_test.number_digits;
+ const std::size_t number_digits = current_test.number_digits;
iv::core::dtoa::DoubleToASCII<false, false, true, false>(
buffer.data(), v, number_digits, &sign, &exponent, &precision);
EXPECT_EQ(0, sign); // All precomputed numbers are positive.
@@ -44,7 +44,7 @@ TEST(DToACase, DToAGayFixed) {
} else {
unsigned dec = exponent + 1;
if (precision > dec) {
- EXPECT_EQ(current_test.decimal_point, dec);
+ EXPECT_EQ(static_cast<std::size_t>(current_test.decimal_point), dec);
} else {
// EXPECT_EQ(current_test.decimal_point, dec);
}
@@ -63,7 +63,7 @@ TEST(DToACase, DToAGayPrecision) {
std::fill(buffer.begin(), buffer.end(), '\0');
const PrecomputedPrecision current_test = *it;
double v = current_test.v;
- const int number_digits = current_test.number_digits;
+ const std::size_t number_digits = current_test.number_digits;
iv::core::dtoa::DoubleToASCII<false, true, false, false>(
buffer.data(), v, number_digits, &sign, &exponent, &precision);
EXPECT_EQ(0, sign); // All precomputed numbers are positive.
View
12 test/test_space.cc
@@ -7,28 +7,28 @@ TEST(SpaceCase, AllocateMemoryAlignemntTest) {
iv::core::ScopedPtr<iv::core::Space> space(new iv::core::Space());
{
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(3));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
{
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(3));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
{
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(3));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
{
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(1000));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
{
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(100));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
{
for (std::size_t i = 0; i < 1000000; ++i) {
uintptr_t mem = reinterpret_cast<uintptr_t>(space->New(23));
- ASSERT_EQ(0, mem % iv::core::Arena::kAlignment);
+ ASSERT_EQ(0u, mem % iv::core::Arena::kAlignment);
}
}
}
View
180 test/test_stringpiece.cc
@@ -170,167 +170,167 @@ TEST(StringPieceCase, StringCastTest) {
TEST(StringPieceCase, FindTest) {
using iv::core::StringPiece;
- EXPECT_EQ(0, StringPiece("TEST").find('T'));
- EXPECT_EQ(1, StringPiece("TEST").find('E'));
- EXPECT_EQ(2, StringPiece("TEST").find('S'));
+ EXPECT_EQ(0u, StringPiece("TEST").find('T'));
+ EXPECT_EQ(1u, StringPiece("TEST").find('E'));
+ EXPECT_EQ(2u, StringPiece("TEST").find('S'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find('O'));
- EXPECT_EQ(3, StringPiece("TEST").find('T', 1));
- EXPECT_EQ(1, StringPiece("TEST").find('E', 1));
- EXPECT_EQ(3, StringPiece("TEST").find('T', 3));
+ EXPECT_EQ(3u, StringPiece("TEST").find('T', 1));
+ EXPECT_EQ(1u, StringPiece("TEST").find('E', 1));
+ EXPECT_EQ(3u, StringPiece("TEST").find('T', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find('S', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find('S', 5));
- EXPECT_EQ(0, StringPiece("TEST").find("TEST"));
- EXPECT_EQ(1, StringPiece("TEST").find("EST"));
- EXPECT_EQ(0, StringPiece("TEST").find("TE"));
+ EXPECT_EQ(0u, StringPiece("TEST").find("TEST"));
+ EXPECT_EQ(1u, StringPiece("TEST").find("EST"));
+ EXPECT_EQ(0u, StringPiece("TEST").find("TE"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find("TESTING"));
- EXPECT_EQ(1, StringPiece("TEST").find("EST", 1));
- EXPECT_EQ(3, StringPiece("TEST").find("T", 2));
+ EXPECT_EQ(1u, StringPiece("TEST").find("EST", 1));
+ EXPECT_EQ(3u, StringPiece("TEST").find("T", 2));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find("T", 1000));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find("TEST", 1));
}
TEST(StringPieceCase, RFindTest) {
using iv::core::StringPiece;
- EXPECT_EQ(3, StringPiece("TEST").rfind('T'));
- EXPECT_EQ(1, StringPiece("TEST").rfind('E'));
- EXPECT_EQ(2, StringPiece("TEST").rfind('S'));
+ EXPECT_EQ(3u, StringPiece("TEST").rfind('T'));
+ EXPECT_EQ(1u, StringPiece("TEST").rfind('E'));
+ EXPECT_EQ(2u, StringPiece("TEST").rfind('S'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").rfind('O'));
- EXPECT_EQ(0, StringPiece("TEST").rfind('T', 1));
- EXPECT_EQ(1, StringPiece("TEST").rfind('E', 1));
- EXPECT_EQ(3, StringPiece("TEST").rfind('T', 3));
- EXPECT_EQ(2, StringPiece("TEST").rfind('S', 100));
+ EXPECT_EQ(0u, StringPiece("TEST").rfind('T', 1));
+ EXPECT_EQ(1u, StringPiece("TEST").rfind('E', 1));
+ EXPECT_EQ(3u, StringPiece("TEST").rfind('T', 3));
+ EXPECT_EQ(2u, StringPiece("TEST").rfind('S', 100));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").rfind('S', 0));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").rfind('S', 1));
- EXPECT_EQ(0, StringPiece("TEST").rfind("TEST"));
- EXPECT_EQ(1, StringPiece("TEST").rfind("EST"));
- EXPECT_EQ(0, StringPiece("TEST").rfind("TE"));
- EXPECT_EQ(3, StringPiece("TEST").rfind("T"));
+ EXPECT_EQ(0u, StringPiece("TEST").rfind("TEST"));
+ EXPECT_EQ(1u, StringPiece("TEST").rfind("EST"));
+ EXPECT_EQ(0u, StringPiece("TEST").rfind("TE"));
+ EXPECT_EQ(3u, StringPiece("TEST").rfind("T"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").rfind("TESTING"));
- EXPECT_EQ(1, StringPiece("TEST").rfind("EST", 1));
- EXPECT_EQ(0, StringPiece("TEST").rfind("T", 2));
- EXPECT_EQ(3, StringPiece("TEST").rfind("T", 1000));
- EXPECT_EQ(0, StringPiece("TEST").rfind("TES", 1));
+ EXPECT_EQ(1u, StringPiece("TEST").rfind("EST", 1));
+ EXPECT_EQ(0u, StringPiece("TEST").rfind("T", 2));
+ EXPECT_EQ(3u, StringPiece("TEST").rfind("T", 1000));
+ EXPECT_EQ(0u, StringPiece("TEST").rfind("TES", 1));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").rfind("ST", 1));
}
TEST(StringPieceCase, FindFirstOfTest) {
using iv::core::StringPiece;
- EXPECT_EQ(0, StringPiece("TEST").find_first_of('T'));
- EXPECT_EQ(1, StringPiece("TEST").find_first_of('E'));
- EXPECT_EQ(2, StringPiece("TEST").find_first_of('S'));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_of('T'));
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_of('E'));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_of('S'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of('O'));
- EXPECT_EQ(0, StringPiece("TEST").find_first_of("TEST"));
- EXPECT_EQ(1, StringPiece("TEST").find_first_of("ES"));
- EXPECT_EQ(2, StringPiece("TEST").find_first_of("S"));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_of("TEST"));
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_of("ES"));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_of("S"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of("O"));
- EXPECT_EQ(3, StringPiece("TEST").find_first_of('T', 1));
- EXPECT_EQ(1, StringPiece("TEST").find_first_of('E', 1));
- EXPECT_EQ(3, StringPiece("TEST").find_first_of('T', 3));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_of('T', 1));
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_of('E', 1));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_of('T', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of('S', 100));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of('S', 3));
- EXPECT_EQ(0, StringPiece("TEST").find_first_of("TEST", 0));
- EXPECT_EQ(1, StringPiece("TEST").find_first_of("EST", 1));
- EXPECT_EQ(0, StringPiece("TEST").find_first_of("TE", 0));
- EXPECT_EQ(3, StringPiece("TEST").find_first_of("TE", 2));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_of("TEST", 0));
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_of("EST", 1));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_of("TE", 0));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_of("TE", 2));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of("O", 2));
}
TEST(StringPieceCase, FindLastOfTest) {
using iv::core::StringPiece;
- EXPECT_EQ(3, StringPiece("TEST").find_last_of('T'));
- EXPECT_EQ(1, StringPiece("TEST").find_last_of('E'));
- EXPECT_EQ(2, StringPiece("TEST").find_last_of('S'));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_of('T'));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_of('E'));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_of('S'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_of('O'));
- EXPECT_EQ(3, StringPiece("TEST").find_last_of("TEST"));
- EXPECT_EQ(2, StringPiece("TEST").find_last_of("ES"));
- EXPECT_EQ(2, StringPiece("TEST").find_last_of("S"));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_of("TEST"));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_of("ES"));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_of("S"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_of("O"));
- EXPECT_EQ(0, StringPiece("TEST").find_last_of('T', 1));
- EXPECT_EQ(1, StringPiece("TEST").find_last_of('E', 1));
- EXPECT_EQ(3, StringPiece("TEST").find_last_of('T', 3));
- EXPECT_EQ(2, StringPiece("TEST").find_last_of('S', 100));
+ EXPECT_EQ(0u, StringPiece("TEST").find_last_of('T', 1));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_of('E', 1));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_of('T', 3));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_of('S', 100));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_of('S', 1));
- EXPECT_EQ(0, StringPiece("TEST").find_last_of("TEST", 0));
- EXPECT_EQ(1, StringPiece("TEST").find_last_of("EST", 1));
- EXPECT_EQ(0, StringPiece("TEST").find_last_of("TE", 0));
- EXPECT_EQ(1, StringPiece("TEST").find_last_of("TE", 2));
+ EXPECT_EQ(0u, StringPiece("TEST").find_last_of("TEST", 0));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_of("EST", 1));
+ EXPECT_EQ(0u, StringPiece("TEST").find_last_of("TE", 0));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_of("TE", 2));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_of("O", 2));
}
TEST(StringPieceCase, FindFirstNotOfTest) {
using iv::core::StringPiece;
- EXPECT_EQ(1, StringPiece("TEST").find_first_not_of('T'));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of('E'));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of('S'));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of('O'));
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_not_of('T'));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of('E'));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of('S'));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of('O'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("TEST"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("TES"));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of("ES"));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of("S"));
- EXPECT_EQ(2, StringPiece("TEST").find_first_not_of("TE"));
- EXPECT_EQ(0, StringPiece("TEST").find_first_not_of("O"));
-
- EXPECT_EQ(1, StringPiece("TEST").find_first_not_of('T', 1));
- EXPECT_EQ(3, StringPiece("TEST").find_first_not_of('S', 2));
- EXPECT_EQ(2, StringPiece("TEST").find_first_not_of('E', 2));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of("ES"));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of("S"));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_not_of("TE"));
+ EXPECT_EQ(0u, StringPiece("TEST").find_first_not_of("O"));
+
+ EXPECT_EQ(1u, StringPiece("TEST").find_first_not_of('T', 1));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_not_of('S', 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_not_of('E', 2));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of('T', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of('S', 100));
- EXPECT_EQ(3, StringPiece("TEST").find_first_not_of('S', 2));
- EXPECT_EQ(3, StringPiece("TEST").find_first_not_of('S', 3));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_not_of('S', 2));
+ EXPECT_EQ(3u, StringPiece("TEST").find_first_not_of('S', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("TEST", 0));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("EST", 1));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("TS", 2));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_first_not_of("ETS", 1));
- EXPECT_EQ(2, StringPiece("TEST").find_first_not_of("TE", 0));
- EXPECT_EQ(2, StringPiece("TEST").find_first_not_of("O", 2));
- EXPECT_EQ(2, StringPiece("TEST").find_first_not_of("TE", 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_not_of("TE", 0));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_not_of("O", 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_first_not_of("TE", 2));
}
TEST(StringPieceCase, FindLastNotOfTest) {
using iv::core::StringPiece;
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of('T'));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of('E'));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of('S'));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of('O'));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of('T'));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of('E'));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of('S'));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of('O'));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("TEST"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("TES"));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("EST"));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of("ES"));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of("S"));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of("TE"));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of("O"));
-
- EXPECT_EQ(1, StringPiece("TEST").find_last_not_of('T', 1));
- EXPECT_EQ(1, StringPiece("TEST").find_last_not_of('S', 2));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of('E', 2));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of('T', 3));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of("ES"));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of("S"));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of("TE"));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of("O"));
+
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_not_of('T', 1));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_not_of('S', 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of('E', 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of('T', 3));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of('T', 0));
- EXPECT_EQ(3, StringPiece("TEST").find_last_not_of('S', 100));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of('T', 100));
- EXPECT_EQ(1, StringPiece("TEST").find_last_not_of('S', 1));
- EXPECT_EQ(0, StringPiece("TEST").find_last_not_of('S', 0));
+ EXPECT_EQ(3u, StringPiece("TEST").find_last_not_of('S', 100));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of('T', 100));
+ EXPECT_EQ(1u, StringPiece("TEST").find_last_not_of('S', 1));
+ EXPECT_EQ(0u, StringPiece("TEST").find_last_not_of('S', 0));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("TEST", 0));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("EST", 1));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("TE", 1));
EXPECT_EQ(StringPiece::npos, StringPiece("TEST").find_last_not_of("ETS", 1));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of("TE", 3));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of("O", 2));
- EXPECT_EQ(2, StringPiece("TEST").find_last_not_of("TE", 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of("TE", 3));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of("O", 2));
+ EXPECT_EQ(2u, StringPiece("TEST").find_last_not_of("TE", 2));
}
View
8 test/test_unicode.cc
@@ -9,10 +9,10 @@ namespace c = iv::core::unicode;
TEST(UnicodeCase, MaskTest) {
const uint32_t ch = 0xFFFF;
- EXPECT_EQ(0xF, c::Mask<4>(ch));
- EXPECT_EQ(0xFF, c::Mask<8>(ch));
- EXPECT_EQ(0xFFF, c::Mask<12>(ch));
- EXPECT_EQ(0xFFFF, c::Mask<16>(ch));
+ EXPECT_EQ(0xFu, c::Mask<4>(ch));
+ EXPECT_EQ(0xFFu, c::Mask<8>(ch));
+ EXPECT_EQ(0xFFFu, c::Mask<12>(ch));
+ EXPECT_EQ(0xFFFFu, c::Mask<16>(ch));
}
TEST(UnicodeCase, UTF8ToUCS4) {

0 comments on commit a519391

Please sign in to comment.