Skip to content

Commit f47194d

Browse files
authored
Merge pull request #150 from scratchcpp/list_blocks_test
Add list blocks test
2 parents 5027103 + bca4a4d commit f47194d

File tree

3 files changed

+409
-1
lines changed

3 files changed

+409
-1
lines changed

src/blocks/listblocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ void ListBlocks::compileLengthOfList(Compiler *compiler)
9090
void ListBlocks::compileListContainsItem(Compiler *compiler)
9191
{
9292
compiler->addInput(ITEM);
93-
compiler->addInstruction(vm::OP_LIST_LENGTH, { compiler->listIndex(compiler->field(LIST)->valuePtr()) });
93+
compiler->addInstruction(vm::OP_LIST_CONTAINS, { compiler->listIndex(compiler->field(LIST)->valuePtr()) });
9494
}

test/blocks/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@ target_link_libraries(
1313
)
1414

1515
gtest_discover_tests(variable_blocks_test)
16+
17+
# list_blocks_test
18+
add_executable(
19+
list_blocks_test
20+
list_blocks_test.cpp
21+
)
22+
23+
target_link_libraries(
24+
list_blocks_test
25+
GTest::gtest_main
26+
GTest::gmock_main
27+
scratchcpp
28+
scratchcpp_mocks
29+
)
30+
31+
gtest_discover_tests(list_blocks_test)

0 commit comments

Comments
 (0)