You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
766 B
30 lines
766 B
2 years ago
|
defmodule BottomTest do
|
||
|
use ExUnit.Case
|
||
|
import Tetris.Bottom
|
||
|
|
||
|
|
||
|
test "Various Collisions" do
|
||
|
bottom = %{{1,1} => {1,1, :blue}}
|
||
|
|
||
|
assert collides? bottom, {1,1}
|
||
|
refute collides? bottom, {1,2}
|
||
|
assert collides? bottom, {1,1, :red}
|
||
|
assert collides? bottom, {1,1, :blue}
|
||
|
refute collides? bottom, {1,2, :red}
|
||
|
|
||
|
assert collides? bottom, [{1,2, :red}, {1,1, :red}]
|
||
|
refute collides? bottom, [{3,2, :blue}, {4,4, :red}]
|
||
|
end
|
||
|
|
||
|
test "test simple merge with bottom" do
|
||
|
bottom = %{{1,1} => {1,1, :blue}}
|
||
|
actual = merge bottom, [{1,2, :red}, {1,3, :red}]
|
||
|
expected = %{
|
||
|
{1,1} => {1, 1, :blue},
|
||
|
{1,2} => {1, 2, :red},
|
||
|
{1,3} => {1, 3, :red}
|
||
|
}
|
||
|
assert actual == expected
|
||
|
end
|
||
|
end
|