Handle decimal points and empty messages.
We were not handling fields with decimal points, or empty messages. Fix
that.
Change-Id: Icde878d211b979a1377d72acfc7bd6aa71872cf1
diff --git a/aos/json_to_flatbuffer_test.cc b/aos/json_to_flatbuffer_test.cc
index 37edbf3..4b0629e 100644
--- a/aos/json_to_flatbuffer_test.cc
+++ b/aos/json_to_flatbuffer_test.cc
@@ -61,6 +61,12 @@
EXPECT_TRUE(JsonAndBack("{ \"foo_string\": \"baz\" }"));
}
+// Tests that we can handle decimal points.
+TEST_F(JsonToFlatbufferTest, DecimalPoint) {
+ EXPECT_TRUE(JsonAndBack("{ \"foo_float\": 5.1 }"));
+ EXPECT_TRUE(JsonAndBack("{ \"foo_double\": 5.1 }"));
+}
+
// Test what happens if you pass a field name that we don't know.
TEST_F(JsonToFlatbufferTest, InvalidFieldName) {
EXPECT_FALSE(JsonAndBack("{ \"foo\": 5 }"));
@@ -133,6 +139,11 @@
"\"wow\" } ] }"));
}
+// Test that we can parse an empty message.
+TEST_F(JsonToFlatbufferTest, EmptyMessage) {
+ EXPECT_TRUE(JsonAndBack("{ }"));
+}
+
// TODO(austin): Missmatched values.
} // namespace testing