feat: add == and != operators to Range class with equality tests

Implement equality comparison for Range objects by defining `range_eqeq` and `range_bangeq` native methods that delegate to `wrenValuesEqual`. Register both operators on the Range class in `wrenInitializeCore` and add a comprehensive test suite in `test/range/equality.wren` covering inclusive/exclusive ranges and cross-type inequality checks.
This commit is contained in:
Gavin Schulz
2015-01-26 03:50:54 +00:00
parent f1d2f2f9c1
commit b0b3256335
2 changed files with 30 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
var a = 2..5
var b = 2..6
var c = 2...5
var d = 2...6
IO.print(a == 2..5) // expect: true
IO.print(a == 2..6) // expect: false
IO.print(c == 2...5) // expect: true
IO.print(c == 2...6) // expect: false
IO.print(b != 2..5) // expect: true
IO.print(b != 2..6) // expect: false
IO.print(d != 2...5) // expect: true
IO.print(d != 2...6) // expect: false
IO.print(a != c) // expect: true
IO.print(b != d) // expect: true