libgraph icon indicating copy to clipboard operation
libgraph copied to clipboard

Failing tests

Open stevensonmt opened this issue 1 year ago • 2 comments

test sizeof/1 (Graph.UtilsTest) assert 440 = sizeof(String.duplicate("bar", 128))

left:  440
right: 456

I can't comment on what's going on here, but on my system 456 seems to be correct as :erlang.system_info(:wordsize) == 8 so sizeof(String.duplicate("bar", 128)) evaluates to 72 + 384 = 456.

test inspect (PriorityQueue.Test) assert "#PriorityQueue<size: 5, queue: 'abcde'>" = str

left:  "#PriorityQueue<size: 5, queue: 'abcde'>"
right: "#PriorityQueue<size: 5, queue: ~c\"abcde\">"

I think this was caused by an Elixir update at some point that prefers the sigil notation over the single-quoted strings. If reproducible would update the test expected value to use the sigil or change the inspect function to convert the sigil to the single-quoted string format.

test inspect (GraphTest) assert "#Graph<type: directed, vertices: [:a, :b, :c], edges: [:a -[foo]-> :b, :a -> :b, :b -[{:complex, :label}]-> :a, :b -> :c]>" = str

left:  "#Graph<type: directed, vertices: [:a, :b, :c], edges: [:a -[foo]-> :b, :a -> :b, :b -[{:complex, :label}]-> :a, :b -> :c]>"
right: "#Graph<type: directed, vertices: [:a, :b, :c], edges: [:a -> :b, :a -[foo]-> :b, :b -[{:complex, :label}]-> :a, :b -> :c]>"

Since edges come from a map the order is not reliable, need to sort before printing to ensure test can pass.

stevensonmt avatar Jan 10 '25 05:01 stevensonmt

https://elixirforum.com/t/convert-charlists-into-c-charlists/49455/8

Confirms the source of the priority queue test failure.

stevensonmt avatar Jan 13 '25 17:01 stevensonmt

Partially fixed in #84 with inspect PriorityQueue now using the current Elixir standard c_sigil notation for charlists. If necessary to support older versions of Elixir the assert could use an or statement.

stevensonmt avatar Jan 14 '25 04:01 stevensonmt