lullaby/tests/script_env_benchmark.cc
// This test verifies that the benchmark code actually behaves correctly.
This test verifies that the benchmark code actually behaves correctly.
This test verifies that the benchmark code actually behaves correctly .
TEST(ScriptEnvBenchmarkTest, BenchmarkTestVerification) {
  Registry registry;
  FunctionBinder binder(&registry);
  RegisterTestFunctions(&binder);
  ScriptEnv env;
  env.SetFunctionCallHandler(
      [&binder](FunctionCall* call) { binder.Call(call); });
  auto script = env.Read(kBenchmarkTestSrc);
  env.Eval(script);
  EXPECT_THAT(*env.GetValue(Symbol("bool")).Get<bool>(), Eq(false));
  EXPECT_THAT(*env.GetValue(Symbol("int16")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("int32")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("int64")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("uint16")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("uint32")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("uint64")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("entity")).Get<int32_t>(), Eq(124));
  EXPECT_THAT(*env.GetValue(Symbol("str")).Get<std::string>(),
              Eq(std::string("abcabc")));
  auto v2 = *env.GetValue(Symbol("v2")).Get<mathfu::vec2>();
  auto v3 = *env.GetValue(Symbol("v3")).Get<mathfu::vec3>();
  auto v4 = *env.GetValue(Symbol("v4")).Get<mathfu::vec4>();
  auto qt = *env.GetValue(Symbol("qt")).Get<mathfu::quat>();
  EXPECT_THAT(v2, Eq(mathfu::vec2(2, 1)));
  EXPECT_THAT(v3, Eq(mathfu::vec3(2, 3, 1)));
  EXPECT_THAT(v4, Eq(mathfu::vec4(2, 3, 4, 1)));
  EXPECT_THAT(qt.vector(), Eq(mathfu::quat(2, 3, 4, 1).vector()));
  EXPECT_THAT(qt.scalar(), Eq(mathfu::quat(2, 3, 4, 1).scalar()));
}
TEST ( ScriptEnvBenchmarkTest , BenchmarkTestVerification ) { Registry registry ; FunctionBinder binder ( & registry ) ; RegisterTestFunctions ( & binder ) ; ScriptEnv env ; env . SetFunctionCallHandler ( [ & binder ] ( FunctionCall * call ) { binder . Call ( call ) ; } ) ; auto script = env . Read ( kBenchmarkTestSrc ) ; env . Eval ( script ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < bool > ( ) , Eq ( false ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < int32_t > ( ) , Eq ( 124 ) ) ; EXPECT_THAT ( * env . GetValue ( Symbol ( " " ) ) . Get < std :: string > ( ) , Eq ( std :: string ( " " ) ) ) ; auto v2 = * env . GetValue ( Symbol ( " " ) ) . Get < mathfu :: vec2 > ( ) ; auto v3 = * env . GetValue ( Symbol ( " " ) ) . Get < mathfu :: vec3 > ( ) ; auto v4 = * env . GetValue ( Symbol ( " " ) ) . Get < mathfu :: vec4 > ( ) ; auto qt = * env . GetValue ( Symbol ( " " ) ) . Get < mathfu :: quat > ( ) ; EXPECT_THAT ( v2 , Eq ( mathfu :: vec2 ( 2 , 1 ) ) ) ; EXPECT_THAT ( v3 , Eq ( mathfu :: vec3 ( 2 , 3 , 1 ) ) ) ; EXPECT_THAT ( v4 , Eq ( mathfu :: vec4 ( 2 , 3 , 4 , 1 ) ) ) ; EXPECT_THAT ( qt . vector ( ) , Eq ( mathfu :: quat ( 2 , 3 , 4 , 1 ) . vector ( ) ) ) ; EXPECT_THAT ( qt . scalar ( ) , Eq ( mathfu :: quat ( 2 , 3 , 4 , 1 ) . scalar ( ) ) ) ; }
This test verifies that the benchmark code actually behaves correctly.
This test verifies that the benchmark code actually behaves correctly .