Added tests for std::object

parent a8105b0b
Pipeline #39495699 passed with stages
in 12 minutes and 58 seconds
......@@ -26,6 +26,7 @@ import test::std::test_io
import test::std::test_iterator
import test::std::test_mirror
import test::std::test_nil
import test::std::test_object
import test::std::test_string
import test::std::test_string_buffer
......
import std::test
import std::test::assert
test.group('std::object::Object.equal?') do (g) {
g.test('Comparing two objects that do not reside at the same address') {
let obj1 = Object.new
let obj2 = Object.new
assert.false(obj1.equal?(obj2))
}
g.test('Comparing two objects that reside at the same address') {
let obj = Object.new
assert.true(obj.equal?(obj))
}
}
test.group('std::object::Object.==') do (g) {
g.test('Comparing two objects that do not reside at the same address') {
let obj1 = Object.new
let obj2 = Object.new
assert.not_equal(obj1, obj2)
}
g.test('Comparing two objects that reside at the same address') {
let obj = Object.new
assert.equal(obj, obj)
}
}
test.group('std::object::Object.!=') do (g) {
g.test('Comparing two objects that do not reside at the same address') {
let obj1 = Object.new
let obj2 = Object.new
assert.true(obj1 != obj2)
}
g.test('Comparing two objects that reside at the same address') {
let obj = Object.new
assert.false(obj != obj)
}
}
test.group('std::object::Object.if_true') do (g) {
g.test('The supplied block is always executed') {
let obj = Object.new
assert.equal(obj.if_true({ 10 }), 10)
}
}
test.group('std::object::Object.if_false') do (g) {
g.test('The supplied block is never executed') {
let obj = Object.new
assert.equal(obj.if_false({ 10 }), Nil)
}
}
test.group('std::object::Object.if') do (g) {
g.test('The block passed to the true: argument is always executed') {
let obj = Object.new
let res = obj.if true: { 10 }, false: { 20 }
assert.equal(res, 10)
}
}
test.group('std::object::Object.and') do (g) {
g.test('The supplied block is always executed') {
let obj = Object.new
assert.true(obj.and({ True }))
}
}
test.group('std::object::Object.or') do (g) {
g.test('The supplied block is never executed') {
let obj = Object.new
assert.true(obj.or({ False }))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment