diff --git a/mix.exs b/mix.exs index 5ccdf56..2eb97c5 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,7 @@ defmodule ExercisesElixir.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:credo, "~> 1.7.0", only: [:dev, :test], runtime: false} + {:credo, "~> 1.7.11", only: [:dev, :test], runtime: false} ] end end diff --git a/mix.lock b/mix.lock index 2c9087a..dc679d5 100644 --- a/mix.lock +++ b/mix.lock @@ -1,6 +1,6 @@ %{ - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, - "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, } diff --git a/modules/20-data-types/10-atoms-and-tuples/lib/solution.ex b/modules/20-data-types/10-atoms-and-tuples/lib/solution.ex index 9f41899..81000d1 100644 --- a/modules/20-data-types/10-atoms-and-tuples/lib/solution.ex +++ b/modules/20-data-types/10-atoms-and-tuples/lib/solution.ex @@ -6,12 +6,12 @@ defmodule Solution do end # BEGIN - def is_point_inside_circle(point, circle) do + def point_inside_circle?(point, circle) do {:circle, center, radius} = circle distance(point, center) <= radius end - def is_point_inside_rect(point, rect) do + def point_inside_rect?(point, rect) do {:point, x, y} = point {:rect, left_top, right_bottom} = rect {:point, left_x, top_y} = left_top diff --git a/modules/20-data-types/10-atoms-and-tuples/ru/EXERCISE.md b/modules/20-data-types/10-atoms-and-tuples/ru/EXERCISE.md index a5edad5..3b286d9 100644 --- a/modules/20-data-types/10-atoms-and-tuples/ru/EXERCISE.md +++ b/modules/20-data-types/10-atoms-and-tuples/ru/EXERCISE.md @@ -1,7 +1,7 @@ -Реализовать функцию `is_point_inside_circle(point, circle)`, которая принимает точку и окружность, и возвращает `true`, если точка находится внутри окружности, или `false`, если точка находится снаружи. +Реализовать функцию `point_inside_circle?(point, circle)`, которая принимает точку и окружность, и возвращает `true`, если точка находится внутри окружности, или `false`, если точка находится снаружи. -Реализовать функцию `is_point_inside_rect(point, rect)`, которая принимает точку и прямоугольник, и возвращает `true`, если точка находится внутри прямоугольника, или `false`, если точка находится снаружи. +Реализовать функцию `point_inside_rect?(point, rect)`, которая принимает точку и прямоугольник, и возвращает `true`, если точка находится внутри прямоугольника, или `false`, если точка находится снаружи. Точка представлена кортежем `{:point, x, y}`. @@ -13,14 +13,14 @@ ```elixir point = {:point, 50, 50} -Solution.is_point_inside_circle(point, {:circle, {:point, 10, 10}, 100}) +Solution.point_inside_circle?(point, {:circle, {:point, 10, 10}, 100}) # => true -Solution.is_point_inside_circle(point, {:circle, {:point, -10, -10}, 20}) +Solution.point_inside_circle?(point, {:circle, {:point, -10, -10}, 20}) # => false point = {:point, -10, 20} -Solution.is_point_inside_rect(point, {:rect, {:point, -20, 30}, {:point, 20, 10}}) +Solution.point_inside_rect?(point, {:rect, {:point, -20, 30}, {:point, 20, 10}}) # => true -Solution.is_point_inside_rect(point, {:rect, {:point, 0, 0}, {:point, 10, 10}}) +Solution.point_inside_rect?(point, {:rect, {:point, 0, 0}, {:point, 10, 10}}) # => false ``` diff --git a/modules/20-data-types/10-atoms-and-tuples/test/solution_test.exs b/modules/20-data-types/10-atoms-and-tuples/test/solution_test.exs index 0d55330..b7f0f8f 100644 --- a/modules/20-data-types/10-atoms-and-tuples/test/solution_test.exs +++ b/modules/20-data-types/10-atoms-and-tuples/test/solution_test.exs @@ -19,13 +19,13 @@ defmodule Test do test "point inside circle" do point = {:point, 50, 50} - assert is_point_inside_circle(point, {:circle, {:point, 10, 10}, 100}) - assert not is_point_inside_circle(point, {:circle, {:point, -10, -10}, 20}) + assert point_inside_circle?(point, {:circle, {:point, 10, 10}, 100}) + assert not point_inside_circle?(point, {:circle, {:point, -10, -10}, 20}) end test "point inside rect" do point = {:point, -10, 20} - assert is_point_inside_rect(point, {:rect, {:point, -20, 30}, {:point, 20, 10}}) - assert not is_point_inside_rect(point, {:rect, {:point, 0, 0}, {:point, 10, 10}}) + assert point_inside_rect?(point, {:rect, {:point, -20, 30}, {:point, 20, 10}}) + assert not point_inside_rect?(point, {:rect, {:point, 0, 0}, {:point, 10, 10}}) end end diff --git a/modules/45-structs/50-any-protocols/test/solution_test.exs b/modules/45-structs/50-any-protocols/test/solution_test.exs index afe8bae..c620865 100644 --- a/modules/45-structs/50-any-protocols/test/solution_test.exs +++ b/modules/45-structs/50-any-protocols/test/solution_test.exs @@ -18,7 +18,7 @@ defmodule Test do end test "for robot" do - assert Teller.impl_for(%Robot{}) == Teller.Any + assert Teller.impl_for(%Robot{}) == Teller.Robot assert Teller.say_something(%Robot{name: "Roberto"}) == "World!" end end