@@ -1733,6 +1733,50 @@ TEST_F(LLVMCodeBuilderTest, Exp)
17331733 addOpTest (nan, 1.0 );
17341734}
17351735
1736+ TEST_F (LLVMCodeBuilderTest, Exp10)
1737+ {
1738+ std::string expected;
1739+
1740+ auto addOpTest = [this , &expected](Value v1, double expectedResult) {
1741+ createBuilder (true );
1742+
1743+ m_builder->addConstValue (v1);
1744+ m_builder->createExp10 ();
1745+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1746+
1747+ m_builder->addConstValue (v1);
1748+ m_builder->addFunctionCall (" test_const_number" , Compiler::StaticType::Number, { Compiler::StaticType::Number });
1749+ m_builder->createExp10 ();
1750+ m_builder->addFunctionCall (" test_print_number" , Compiler::StaticType::Void, { Compiler::StaticType::Number });
1751+
1752+ std::stringstream stream;
1753+ stream << expectedResult;
1754+ std::string str = stream.str () + ' \n ' ;
1755+ std::string expected = str + str;
1756+
1757+ auto code = m_builder->finalize ();
1758+ auto ctx = code->createExecutionContext (&m_target);
1759+
1760+ testing::internal::CaptureStdout ();
1761+ code->run (ctx.get ());
1762+ const std::string quotes1 = v1.isString () ? " \" " : " " ;
1763+ ASSERT_THAT (testing::internal::GetCapturedStdout (), Eq (expected)) << quotes1 << v1.toString () << quotes1;
1764+ };
1765+
1766+ static const double inf = std::numeric_limits<double >::infinity ();
1767+ static const double nan = std::numeric_limits<double >::quiet_NaN ();
1768+
1769+ addOpTest (1.0 , 10.0 );
1770+ addOpTest (3.0 , 1000.0 );
1771+ addOpTest (0.0 , 1.0 );
1772+ addOpTest (-0.0 , 1.0 );
1773+ addOpTest (-1.0 , 0.1 );
1774+ addOpTest (-5.0 , 0.00001 );
1775+ addOpTest (inf, inf);
1776+ addOpTest (-inf, 0.0 );
1777+ addOpTest (nan, 1.0 );
1778+ }
1779+
17361780TEST_F (LLVMCodeBuilderTest, Yield)
17371781{
17381782 auto build = [this ]() {
0 commit comments