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:
@@ -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
|
||||
Reference in New Issue
Block a user