This commit is contained in:
2024-06-27 01:56:32 -04:00
parent eb76c60826
commit fcc4ddb61c
10 changed files with 273 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
defmodule PrimeTest do
use ExUnit.Case
test "first prime" do
assert Prime.nth(1) == 2
end
test "second prime" do
assert Prime.nth(2) == 3
end
test "sixth prime" do
assert Prime.nth(6) == 13
end
test "100th prime" do
assert Prime.nth(100) == 541
end
@tag :slow
test "big prime" do
assert Prime.nth(10001) == 104_743
end
@tag :slow
test "very big prime" do
assert Prime.nth(100001) == 1_299_721
end
test "there is no zeroth prime" do
catch_error(Prime.nth(0))
end
end

View File

@@ -0,0 +1,2 @@
ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)