mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
18 lines
631 B
Elixir
18 lines
631 B
Elixir
defmodule Ash.Test.Type.VectorTest do
|
|
@moduledoc false
|
|
use ExUnit.Case, async: true
|
|
|
|
test "it casts list to Ash.Vector" do
|
|
list = [1.0, 2.0, 3.0]
|
|
|
|
assert {:ok, vector} = Ash.Type.cast_input(Ash.Type.Vector, list)
|
|
assert {:ok, ^vector} = Ash.Type.dump_to_native(Ash.Type.Vector, list)
|
|
assert {:ok, ^vector} = Ash.Type.dump_to_native(Ash.Type.Vector, vector)
|
|
end
|
|
|
|
test "it casts nil to nil" do
|
|
assert {:ok, nil} = Ash.Type.cast_input(Ash.Type.Vector, nil)
|
|
assert {:ok, nil} = Ash.Type.cast_stored(Ash.Type.Vector, nil)
|
|
assert {:ok, nil} = Ash.Type.dump_to_native(Ash.Type.Vector, nil)
|
|
end
|
|
end
|