Parcourir la source

[3015] Updated comments and tests

Kazunori Fujiwara il y a 11 ans
Parent
commit
1176cc4839
2 fichiers modifiés avec 15 ajouts et 10 suppressions
  1. 0 5
      src/lib/cc/data.cc
  2. 15 5
      src/lib/cc/tests/data_unittests.cc

+ 0 - 5
src/lib/cc/data.cc

@@ -393,11 +393,6 @@ numberFromStringstream(std::istream& in, int& pos) {
 // that can also hold an e value? (and have specific getters if the
 // value is larger than an int can handle)
 //
-// Type of IntElement is changed from long int to int64_t.
-// However, strtoint64_t function does not exist.
-// It is assumed that "long long" and int64_t are the same sizes.
-// strtoll is used to convert string to integer.
-//
 ElementPtr
 fromStringstreamNumber(std::istream& in, int& pos) {
     std::string number = numberFromStringstream(in, pos);

+ 15 - 5
src/lib/cc/tests/data_unittests.cc

@@ -205,7 +205,9 @@ testGetValueInt() {
     std::map<std::string, ConstElementPtr> m;
 
     el = Element::create(1);
-    EXPECT_NO_THROW(el->intValue());
+    EXPECT_NO_THROW({
+       EXPECT_EQ(1, el->intValue());
+    });
     EXPECT_THROW(el->doubleValue(), TypeError);
     EXPECT_THROW(el->boolValue(), TypeError);
     EXPECT_THROW(el->stringValue(), TypeError);
@@ -220,25 +222,33 @@ testGetValueInt() {
     EXPECT_EQ(1, i);
 
     el = Element::create(9223372036854775807LL);
-    EXPECT_NO_THROW(el->intValue());
+    EXPECT_NO_THROW({
+       EXPECT_EQ(9223372036854775807LL, el->intValue());
+    });
     EXPECT_TRUE(el->getValue(i));
     EXPECT_EQ(9223372036854775807LL, i);
 
     ll = 9223372036854775807LL;
     el = Element::create(ll);
-    EXPECT_NO_THROW(el->intValue());
+    EXPECT_NO_THROW({
+       EXPECT_EQ(ll, el->intValue());
+    });
     EXPECT_TRUE(el->getValue(i));
     EXPECT_EQ(ll, i);
 
     i32 = 2147483647L;
     el = Element::create(i32);
-    EXPECT_NO_THROW(el->intValue());
+    EXPECT_NO_THROW({
+       EXPECT_EQ(i32, el->intValue());
+    });
     EXPECT_TRUE(el->getValue(i));
     EXPECT_EQ(i32, i);
 
     l = 2147483647L;
     el = Element::create(l);
-    EXPECT_NO_THROW(el->intValue());
+    EXPECT_NO_THROW({
+       EXPECT_EQ(l, el->intValue());
+    });
     EXPECT_TRUE(el->getValue(i));
     EXPECT_EQ(l, i);
 }