Sha256: f2503996ce707039d9a3af9ec5b256cf35be4b617831a3526cd75ccb101ef76a

Contents?: true

Size: 1.17 KB

Versions: 69

Compression:

Stored size: 1.17 KB

Contents

if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("pythagorean_triplet.exs", __DIR__)
end

ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)

defmodule PythagoreanTripletTest do
  use ExUnit.Case

  # @tag :pending
  test "sum" do
    triplet = [3, 4, 5]
    assert Triplet.sum(triplet) == 12
  end

  @tag :pending
  test "product" do
    triplet = [3, 4, 5]
    assert Triplet.product(triplet) == 60
  end

  @tag :pending
  test "pythagorean" do
    triplet = [3, 4, 5]
    assert Triplet.pythagorean?(triplet)
  end

  @tag :pending
  test "not pythagorean" do
    triplet = [5, 6, 7]
    refute Triplet.pythagorean?(triplet)
  end

  @tag :pending
  test "triplets up to 10" do
    triplets = Triplet.generate(1, 10)
    assert Enum.map(triplets, &Triplet.product/1) == [60, 480]
  end

  @tag :pending
  test "triplets from 11 up to 20" do
    triplets = Triplet.generate(11, 20)
    assert Enum.map(triplets, &Triplet.product/1) == [3840]
  end

  @tag :pending
  test "triplets where sum is 180 and max factor is 100" do
    triplets = Triplet.generate(1, 100, 180)
    assert Enum.map(triplets, &Triplet.product/1) == [118_080, 168_480, 202_500]
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.118 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.117 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.116 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.115 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.114 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.113 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.111 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs
trackler-2.2.1.110 tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs