Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/tests/BLI_serialize_test.cc
- This file was added.
| /* Apache License, Version 2.0 */ | |||||
| #include "testing/testing.h" | |||||
| #include "BLI_serialize.hh" | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /* tests */ | |||||
| namespace blender::io::serialize::json::testing { | |||||
| TEST(serialize, string_to_json) | |||||
| { | |||||
| JsonFormatter json; | |||||
| std::stringstream out; | |||||
| Value test_value(std::string("Hello JSON")); | |||||
| json.serialize(out, test_value); | |||||
| EXPECT_EQ(out.str(), "\"Hello JSON\""); | |||||
| } | |||||
| TEST(serialize, int_to_json) | |||||
| { | |||||
| JsonFormatter json; | |||||
| std::stringstream out; | |||||
| Value test_value(42); | |||||
| json.serialize(out, test_value); | |||||
sybren: Also test with bigger & negative integers! | |||||
| EXPECT_EQ(out.str(), "42"); | |||||
| } | |||||
| } // namespace blender::io::serialize::json::testing | |||||
Done Inline ActionsWould prefer const. Severin: Would prefer `const`. | |||||
Done Inline ActionsThe type is called FloatValue but you test with a double literal. Be sure to actually test the precision by which these are saved, if you want to actually test doubles. sybren: The type is called `FloatValue` but you test with a `double` literal. Be sure to actually test… | |||||
Also test with bigger & negative integers!