@@ -1467,6 +1467,52 @@ TEST_F(LLVMCodeBuilderTest, Tan)
14671467 addOpTest (nan, 0.0 );
14681468}
14691469
1470+ TEST_F (LLVMCodeBuilderTest, Asin)
1471+ {
1472+ std::string expected;
1473+
1474+ auto addOpTest = [this , &expected](Value v1, double expectedResult) {
1475+ createBuilder (true );
1476+
1477+ m_builder->addConstValue (v1);
1478+ m_builder->createAsin ();
1479+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1480+
1481+ m_builder->addConstValue (v1);
1482+ m_builder->addFunctionCall (" test_const_number" , Compiler::StaticType::Number, { Compiler::StaticType::Number });
1483+ m_builder->createAsin ();
1484+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1485+
1486+ std::stringstream stream;
1487+ stream << expectedResult;
1488+ std::string str = stream.str () + ' \n ' ;
1489+ std::string expected = str + str;
1490+
1491+ auto code = m_builder->finalize ();
1492+ auto ctx = code->createExecutionContext (&m_target);
1493+
1494+ testing::internal::CaptureStdout ();
1495+ code->run (ctx.get ());
1496+ const std::string quotes1 = v1.isString () ? " \" " : " " ;
1497+ ASSERT_THAT (testing::internal::GetCapturedStdout (), Eq (expected)) << quotes1 << v1.toString () << quotes1;
1498+ };
1499+
1500+ static const double inf = std::numeric_limits<double >::infinity ();
1501+ static const double nan = std::numeric_limits<double >::quiet_NaN ();
1502+
1503+ addOpTest (1.0 , 90.0 );
1504+ addOpTest (0.5 , 30.0 );
1505+ addOpTest (0.0 , 0.0 );
1506+ addOpTest (-0.0 , 0.0 );
1507+ addOpTest (-0.5 , -30.0 );
1508+ addOpTest (-1.0 , -90.0 );
1509+ addOpTest (1.1 , nan);
1510+ addOpTest (-1.2 , nan);
1511+ addOpTest (inf, nan);
1512+ addOpTest (-inf, nan);
1513+ addOpTest (nan, 0.0 );
1514+ }
1515+
14701516TEST_F (LLVMCodeBuilderTest, Yield)
14711517{
14721518 auto build = [this ]() {
0 commit comments