Sha256: 829a1de5ae5443fdd720cd6b6383654d9944616ebe8739b5802b41782ae45180

Contents?: true

Size: 1.79 KB

Versions: 69

Compression:

Stored size: 1.79 KB

Contents

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

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

defmodule SecretHandshakeTest do
  use ExUnit.Case

  describe "Create a handshake for a number" do
    # @tag :pending
    test "wink for 1" do
      assert SecretHandshake.commands(1) == ["wink"]
    end

    @tag :pending
    test "double blink for 10" do
      assert SecretHandshake.commands(2) == ["double blink"]
    end

    @tag :pending
    test "close your eyes for 100" do
      assert SecretHandshake.commands(4) == ["close your eyes"]
    end

    @tag :pending
    test "jump for 1000" do
      assert SecretHandshake.commands(8) == ["jump"]
    end

    @tag :pending
    test "combine two actions" do
      assert SecretHandshake.commands(3) == ["wink", "double blink"]
    end

    @tag :pending
    test "reverse two actions" do
      assert SecretHandshake.commands(19) == ["double blink", "wink"]
    end

    @tag :pending
    test "reversing one action gives the same action" do
      assert SecretHandshake.commands(24) == ["jump"]
    end

    @tag :pending
    test "reversing no actions still gives no actions" do
      assert SecretHandshake.commands(16) == []
    end

    @tag :pending
    test "all possible actions" do
      assert SecretHandshake.commands(15) == ["wink", "double blink", "close your eyes", "jump"]
    end

    @tag :pending
    test "reverse all possible actions" do
      assert SecretHandshake.commands(31) == ["jump", "close your eyes", "double blink", "wink"]
    end

    @tag :pending
    test "do nothing for zero" do
      assert SecretHandshake.commands(0) == []
    end

    @tag :pending
    test "do nothing if lower 5 bits not set" do
      assert SecretHandshake.commands(32) == []
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.179 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.178 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.177 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.176 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.175 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.174 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.173 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.172 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.171 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.170 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.169 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.167 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.166 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.165 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.164 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.163 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.162 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.161 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs
trackler-2.2.1.160 tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs