elixir - How do I compare Dict literal with a constructed Dict? -


i'm trying test algorithm builds hashdict, can't "expected" actually equal "actual." example,

iex> expected = hashdict.new([ key: 12 ]) #hashdict<[foo: 12]>  iex> actual = dict.put(hashdict.new, "key", 12) #hashdict<[{"foo", 12}]> 

i can second "style" of hashdict in literal declaring in more obtuse way:

iex> hashdict.new([ { "key", 12 } ]) #hashdict<[{"foo", 12}]> 

i simple dict literal syntax test case, implementation builds dict recursively. how can make these equal?

in first case key atom, in second case string.

you can on iex:

expected = hashdict.new([key: 12]) actual = dict.put(hashdict.new, :key, 12) dict.equals? actual, expected # returns true 

for more information visit: http://elixir-lang.org/docs/stable/


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -