<commit_before>from virtual_machine import VirtualMachine
from frame import Frame

from unittest.mock import MagicMock

class TestVirtualMachine:
    def setup_method(self):
        self.vm = VirtualMachine()

    def test_instr_COMPARE_OP__lt_sets_top_of_stack_to_false(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([0])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__lt_sets_top_of_stack_to_true(self):
        a = 7
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([0])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__le_sets_top_of_stack_to_false(self):
        a = 10
        b = 7
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([1])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__le_sets_top_of_stack_to_true(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([1])
        assert frame.stack == [True]<commit_msg>WIP: Implement eq, ne, ge, gt, and in comparisons.<commit_after>from virtual_machine import VirtualMachine
from frame import Frame

from unittest.mock import MagicMock

class TestVirtualMachine:
    def setup_method(self):
        self.vm = VirtualMachine()

    def test_instr_COMPARE_OP__lt_sets_top_of_stack_to_false(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([0])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__lt_sets_top_of_stack_to_true(self):
        a = 7
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([0])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__le_sets_top_of_stack_to_false(self):
        a = 10
        b = 7
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([1])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__le_sets_top_of_stack_to_true(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([1])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__eq_sets_top_of_stack_to_false(self):
        a = 10
        b = 7
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([2])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__eq_sets_top_of_stack_to_true(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([2])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__ne_sets_top_of_stack_to_false(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([3])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__ne_sets_top_of_stack_to_true(self):
        a = 10
        b = 7
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([3])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__gt_sets_top_of_stack_to_false(self):
        a = 7
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([4])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__gt_sets_top_of_stack_to_true(self):
        a = 10
        b = 7
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([4])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__ge_sets_top_of_stack_to_false(self):
        a = 7
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([5])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__ge_sets_top_of_stack_to_true(self):
        a = 10
        b = 10
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([5])
        assert frame.stack == [True]

    def test_instr_COMPARE_OP__in_sets_top_of_stack_to_false(self):
        a = 7
        b = [10]
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([6])
        assert frame.stack == [False]

    def test_instr_COMPARE_OP__in_sets_top_of_stack_to_true(self):
        a = 10
        b = [7, 10]
        frame = MagicMock()
        frame.stack = [a, b]
        self.vm.push_frame(frame)
        self.vm.instr_COMPARE_OP([6])
        assert frame.stack == [True]
{'fraction_non_alphanumeric': 0.10278413424866514, 'fraction_numerical': 0.015446224256292907, 'mean_word_length': 2.153938665063139, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2221479', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1805, 'n_words': 332}