Exemple #1
0
def test_PrimitiveFalseObject_is():
    o = PrimitiveFalseObject()

    is_slot = o.slot_lookup("is:")
    result = is_slot.map.primitive_code(None, o, [PrimitiveFalseObject()])
    assert result == PrimitiveTrueObject()

    is_slot = o.slot_lookup("is:")
    result = is_slot.map.primitive_code(None, o, [PrimitiveIntObject(3)])
    assert result == PrimitiveFalseObject()

    is_slot = o.slot_lookup("is:")
    result = is_slot.map.primitive_code(None, o, [PrimitiveTrueObject()])
    assert result == PrimitiveFalseObject()
def test_PrimitiveNilObject_equals():
    o = PrimitiveNilObject()

    eq_slot = o.slot_lookup("==")
    result = eq_slot.map.primitive_code(None, o, [PrimitiveNilObject()])
    assert result == PrimitiveTrueObject()

    eq_slot = o.slot_lookup("==")
    result = eq_slot.map.primitive_code(None, o, [PrimitiveIntObject(3)])
    assert result == PrimitiveFalseObject()

    eq_slot = o.slot_lookup("==")
    result = eq_slot.map.primitive_code(None, o, [PrimitiveTrueObject()])
    assert result == PrimitiveFalseObject()
Exemple #3
0
def test_PrimitiveIntObject_lower_or_equal():
    call_primitive_int_binary_op(1, "<=", 5, equals=PrimitiveTrueObject())
    call_primitive_int_binary_op(5, "<=", 1, equals=PrimitiveFalseObject())
    call_primitive_int_binary_op(1, "<=", 1, equals=PrimitiveTrueObject())
Exemple #4
0
def test_PrimitiveIntObject_greater():
    call_primitive_int_binary_op(4, ">", 3, equals=PrimitiveTrueObject())
    call_primitive_int_binary_op(1, ">", 5, equals=PrimitiveFalseObject())
    call_primitive_int_binary_op(1, ">", 1, equals=PrimitiveFalseObject())
Exemple #5
0
def test_PrimitiveTrueObject():
    assert PrimitiveTrueObject()