8000 Crashes with standard equality check · Issue #16 · evnu/closed_intervals · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Crashes with standard equality check #16
Open
@turion

Description

@turion

I applied this change:

diff --git a/test/closed_intervals_test.exs b/test/closed_intervals_test.exs
index 36f1c90..9348dbb 100644
--- a/test/closed_intervals_test.exs
+++ b/test/closed_intervals_test.exs
@@ -50,7 +50,7 @@ defmodule ClosedIntervalsTest do
     end
 
     test "get_interval" do
-      tree = from([1, 2, 3, 4])
+      tree = from([1, 2, 3, 4], eq: &==/2)
       assert {1, 2} == get_interval(tree, 2)
       assert {1, 2} == get_interval(tree, 1.5)
       assert {2, 3} == get_interval(tree, 2.5)

It crashes:

$ mix test test/closed_intervals_test.exs:52
Excluding tags: [:test]
Including tags: [line: "52"]



  1) test default order get_interval (ClosedIntervalsTest)
     test/closed_intervals_test.exs:52
     ** (CaseClauseError) no case clause matching: [{1, 2}, {2, 3}]
     code: assert {1, 2} == get_interval(tree, 2)
     stacktrace:
       (closed_intervals 0.5.0) lib/closed_intervals.ex:166: ClosedIntervals.get_interval/2
       test/closed_intervals_test.exs:54: (test)



Finished in 0.1 seconds (0.00s async, 0.1s sync)
11 doctests, 2 properties, 6 tests, 1 failure, 18 excluded

Randomized with seed 659730

I find that surprising since this is the most straightforward equality function I can think of. Found while working at a PR for #15

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0