Skip to content

Commit 1563f71

Browse files
committed
Verify implementation functions in operator blocks test
1 parent cb15d7d commit 1563f71

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/blocks/operator_blocks_test.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
using namespace libscratchcpp;
1212

13+
using ::testing::Return;
14+
1315
class OperatorBlocksTest : public testing::Test
1416
{
1517
public:
@@ -633,7 +635,7 @@ TEST_F(OperatorBlocksTest, Round)
633635

634636
TEST_F(OperatorBlocksTest, MathOp)
635637
{
636-
Compiler compiler(&m_engine);
638+
Compiler compiler(&m_engineMock);
637639
std::vector<std::shared_ptr<Block>> blocks;
638640
std::shared_ptr<Block> block;
639641

@@ -725,6 +727,24 @@ TEST_F(OperatorBlocksTest, MathOp)
725727

726728
for (auto block : blocks) {
727729
compiler.setBlock(block);
730+
731+
switch (block->fieldAt(0)->specialValueId()) {
732+
case OperatorBlocks::Ln:
733+
EXPECT_CALL(m_engineMock, functionIndex(&OperatorBlocks::op_ln)).WillOnce(Return(0));
734+
break;
735+
case OperatorBlocks::Log:
736+
EXPECT_CALL(m_engineMock, functionIndex(&OperatorBlocks::op_log)).WillOnce(Return(1));
737+
break;
738+
case OperatorBlocks::Eexp:
739+
EXPECT_CALL(m_engineMock, functionIndex(&OperatorBlocks::op_eexp)).WillOnce(Return(2));
740+
break;
741+
case OperatorBlocks::Op_10exp:
742+
EXPECT_CALL(m_engineMock, functionIndex(&OperatorBlocks::op_10exp)).WillOnce(Return(3));
743+
break;
744+
default:
745+
break;
746+
}
747+
728748
OperatorBlocks::compileMathOp(&compiler);
729749
}
730750

0 commit comments

Comments
 (0)