@@ -1513,6 +1513,52 @@ TEST_F(LLVMCodeBuilderTest, Asin)
15131513 addOpTest (nan, 0.0 );
15141514}
15151515
1516+ TEST_F (LLVMCodeBuilderTest, Acos)
1517+ {
1518+ std::string expected;
1519+
1520+ auto addOpTest = [this , &expected](Value v1, double expectedResult) {
1521+ createBuilder (true );
1522+
1523+ m_builder->addConstValue (v1);
1524+ m_builder->createAcos ();
1525+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1526+
1527+ m_builder->addConstValue (v1);
1528+ m_builder->addFunctionCall (" test_const_number" , Compiler::StaticType::Number, { Compiler::StaticType::Number });
1529+ m_builder->createAcos ();
1530+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1531+
1532+ std::stringstream stream;
1533+ stream << expectedResult;
1534+ std::string str = stream.str () + ' \n ' ;
1535+ std::string expected = str + str;
1536+
1537+ auto code = m_builder->finalize ();
1538+ auto ctx = code->createExecutionContext (&m_target);
1539+
1540+ testing::internal::CaptureStdout ();
1541+ code->run (ctx.get ());
1542+ const std::string quotes1 = v1.isString () ? " \" " : " " ;
1543+ ASSERT_THAT (testing::internal::GetCapturedStdout (), Eq (expected)) << quotes1 << v1.toString () << quotes1;
1544+ };
1545+
1546+ static const double inf = std::numeric_limits<double >::infinity ();
1547+ static const double nan = std::numeric_limits<double >::quiet_NaN ();
1548+
1549+ addOpTest (1.0 , 0.0 );
1550+ addOpTest (0.5 , 60.0 );
1551+ addOpTest (0.0 , 90.0 );
1552+ addOpTest (-0.0 , 90.0 );
1553+ addOpTest (-0.5 , 120.0 );
1554+ addOpTest (-1.0 , 180.0 );
1555+ addOpTest (1.1 , nan);
1556+ addOpTest (-1.2 , nan);
1557+ addOpTest (inf, nan);
1558+ addOpTest (-inf, nan);
1559+ addOpTest (nan, 90.0 );
1560+ }
1561+
15161562TEST_F (LLVMCodeBuilderTest, Yield)
15171563{
15181564 auto build = [this ]() {
0 commit comments