using Push
using Test

# Peek.
x = [10, 20, 30, 40, 50]
@test Push.peek(x) == 50

# Shove.
x = [10, 20, 30, 40, 50]
@test Push.shove!(x, 0) == [10, 20, 30, 40, 50]
@test Push.shove!(x, 1) == [10, 20, 30, 50, 40]
x = [10, 20, 30, 40, 50]
@test Push.shove!(x, 2) == [10, 20, 50, 30, 40]
x = [10, 20, 30, 40, 50]
@test Push.shove!(x, 4) == [50, 10, 20, 30, 40]
x = [10, 20, 30, 40, 50]
@test Push.shove!(x, 12) == [50, 10, 20, 30, 40]
x = [10, 20, 30, 40, 50]
@test Push.shove!(x, -31) == [10, 20, 30, 40, 50]

# Yank.
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 0) == [10, 20, 30, 40, 50]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 1) == [10, 20, 30, 50, 40]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 2) == [10, 20, 40, 50, 30]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 4) == [20, 30, 40, 50, 10]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 12) == [20, 30, 40, 50, 10]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, 0) == [10, 20, 30, 40, 50]
x = [10, 20, 30, 40, 50]
@test Push.yank!(x, -20) == [10, 20, 30, 40, 50]

# Yank duplicate.
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, 0) == [10, 20, 30, 40, 50, 50]
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, 1) == [10, 20, 30, 40, 50, 40]
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, 2) == [10, 20, 30, 40, 50, 30]
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, 4) == [10, 20, 30, 40, 50, 10]
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, 10) == [10, 20, 30, 40, 50, 10]
x = [10, 20, 30, 40, 50]
@test Push.yankdup!(x, -10) == [10, 20, 30, 40, 50, 50]
