30 #include <gtest/gtest.h>
36 TEST(array_parser, basic_operation)
39 std::vector<std::vector<float> > vvf;
40 vvf =
parseVVF(
"[[1, 2.2], [.3, -4e4]]", error );
41 EXPECT_EQ( 2, vvf.size() );
42 EXPECT_EQ( 2, vvf[0].size() );
43 EXPECT_EQ( 2, vvf[1].size() );
44 EXPECT_EQ( 1.0
f, vvf[0][0] );
45 EXPECT_EQ( 2.2
f, vvf[0][1] );
46 EXPECT_EQ( 0.3
f, vvf[1][0] );
47 EXPECT_EQ( -40000.0
f, vvf[1][1] );
48 EXPECT_EQ(
"", error );
51 TEST(array_parser, missing_open)
54 std::vector<std::vector<float> > vvf;
55 vvf =
parseVVF(
"[1, 2.2], [.3, -4e4]]", error );
56 EXPECT_FALSE( error ==
"" );
59 TEST(array_parser, missing_close)
62 std::vector<std::vector<float> > vvf;
63 vvf =
parseVVF(
"[[1, 2.2], [.3, -4e4]", error );
64 EXPECT_FALSE( error ==
"" );
67 TEST(array_parser, wrong_depth)
70 std::vector<std::vector<float> > vvf;
71 vvf =
parseVVF(
"[1, 2.2], [.3, -4e4]", error );
72 EXPECT_FALSE( error ==
"" );
75 int main(
int argc,
char** argv)
77 testing::InitGoogleTest( &argc, argv );
78 return RUN_ALL_TESTS();