   def test_is_even_in_guards(_number),
     do: false
 
-  test "is_odd" do
+  test "is_odd/1" do
     assert Integer.is_odd(0) == false
     assert Integer.is_odd(1) == true
     assert Integer.is_odd(2) == false

    assert test_is_even_in_guards(11) == false
  end

  test "digits" do
    assert Integer.digits(101) == [1, 0, 1]
    assert Integer.digits(1) == [1]
    assert Integer.digits(0) == [0]
    assert Integer.digits(0, 2) == [0]
    assert Integer.digits(58127, 2) == [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]
    assert Integer.digits(987654, 987654) == [1, 0]
  end

  test "undigits" do
    assert Integer.undigits([1, 0, 1]) == 101
    assert Integer.undigits([1]) == 1
    assert Integer.undigits([0]) == 0
    assert Integer.undigits([]) == 0
    assert Integer.undigits([1, 4], 16) == 0x14
    assert Integer.undigits([1, 4], 8) == 0o14
    assert Integer.undigits([1, 1], 2) == 0b11
    assert Integer.undigits([1, 2, 3, 4, 5]) == 12345
    assert Integer.undigits([1, 0, -5]) == 95
    assert Integer.undigits([-1, -1, -5]) == -115
  end

  test "parse" do
    assert Integer.parse("12") === {12, ""}
    assert Integer.parse("+12") === {12, ""}
    assert Integer.parse("-12") === {-12, ""}
    assert Integer.parse("123456789") === {123456789, ""}

    assert Integer.parse("++4", 10) === :error

    # Base should be in range 2..36
    assert_raise ArgumentError, "invalid base 1", fn -> Integer.parse("2", 1) end
    assert_raise ArgumentError, "invalid base 37", fn -> Integer.parse("2", 37) end

    # Base should be an integer
    assert_raise ArgumentError, "invalid base 10.2", fn -> Integer.parse("2", 10.2) end
  end

  test "to_string/1" do
    assert Integer.to_string(42) == "42"
    assert Integer.to_string(+42) == "42"
    assert Integer.to_string(-42) == "-42"
    assert Integer.to_string(-0001) == "-1"

    for n <- [42.0, :forty_two, '42', "42"] do
      assert_raise ArgumentError, fn ->
        Integer.to_string(n)
      end
    end
  end

  test "to_string/2" do
    assert Integer.to_string(42, 2) == "101010"
    assert Integer.to_string(42, 10) == "42"
    assert Integer.to_string(42, 16) == "2A"
    assert Integer.to_string(+42, 16) == "2A"
    assert Integer.to_string(-42, 16) == "-2A"
    assert Integer.to_string(-042, 16) == "-2A"

    for n <- [42.0, :forty_two, '42', "42"] do
      assert_raise ArgumentError, fn ->
        Integer.to_string(n, 42)
      end
    end

    for n <- [-1, 0, 1, 37] do
      assert_raise ArgumentError, fn ->
        Integer.to_string(42, n)
      end

      assert_raise ArgumentError, fn ->
        Integer.to_string(n, n)
      end
    end
  end

  test "to_char_list/1" do
    assert Integer.to_char_list(42) == '42'
    assert Integer.to_char_list(+42) == '42'
    assert Integer.to_char_list(-42) == '-42'
    assert Integer.to_char_list(-0001) == '-1'

    for n <- [42.0, :forty_two, '42', "42"] do
      assert_raise ArgumentError, fn ->
        Integer.to_char_list(n)
      end
    end
  end

  test "to_char_list/2" do
    assert Integer.to_char_list(42, 2) == '101010'
    assert Integer.to_char_list(42, 10) == '42'
    assert Integer.to_char_list(42, 16) == '2A'
    assert Integer.to_char_list(+42, 16) == '2A'
    assert Integer.to_char_list(-42, 16) == '-2A'
    assert Integer.to_char_list(-042, 16) == '-2A'

    for n <- [42.0, :forty_two, '42', "42"] do
      assert_raise ArgumentError, fn ->
        Integer.to_char_list(n, 42)
      end
    end

    for n <- [-1, 0, 1, 37] do
      assert_raise ArgumentError, fn ->
        Integer.to_char_list(42, n)
      end

      assert_raise ArgumentError, fn ->
        Integer.to_char_list(n, n)
      end
    end
  end
end
