Skip to content

Commit a040fc3

Browse files
committed
Add unittest for long as int in MSC platforms
1 parent 294a5ac commit a040fc3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/unittest/valuetest.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,14 @@ TEST(Value, Int) {
439439
EXPECT_EQ(5678, z.Get<int>());
440440
EXPECT_EQ(5679, z.Set(5679).Get<int>());
441441
EXPECT_EQ(5680, z.Set<int>(5680).Get<int>());
442+
443+
#ifdef _MSC_VER
444+
// long as int on MSC platforms
445+
RAPIDJSON_STATIC_ASSERT(sizeof(long) == sizeof(int));
446+
z.SetInt(1234);
447+
EXPECT_TRUE(z.Is<long>());
448+
EXPECT_EQ(1234l, z.Get<long>());
449+
#endif
442450
}
443451

444452
TEST(Value, Uint) {
@@ -485,6 +493,14 @@ TEST(Value, Uint) {
485493
EXPECT_EQ(2147483648u, z.Get<unsigned>());
486494
EXPECT_EQ(2147483649u, z.Set(2147483649u).Get<unsigned>());
487495
EXPECT_EQ(2147483650u, z.Set<unsigned>(2147483650u).Get<unsigned>());
496+
497+
#ifdef _MSC_VER
498+
// unsigned long as unsigned on MSC platforms
499+
RAPIDJSON_STATIC_ASSERT(sizeof(unsigned long) == sizeof(unsigned));
500+
z.SetUint(1234);
501+
EXPECT_TRUE(z.Is<unsigned long>());
502+
EXPECT_EQ(1234ul, z.Get<unsigned>());
503+
#endif
488504
}
489505

490506
TEST(Value, Int64) {

0 commit comments

Comments
 (0)