Ошибка в эталонном решении и тестах subnet_checker.clj
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- clojure
- Domain
- testing-qa
Research direction
Start with subnet_checker.clj and inspect both the reference solution and the test-data generator. Run the existing tests to reproduce the incorrect subnet membership behavior and weak cases. Done means membership uses the subnet mask correctly and generated tests produce IPs that are deliberately inside or outside the generated subnet.
Written by the indexing model from the issue text.
Description
В задаче осталось несколько недочетов:
- Эталонное решение не корректное - производится проверка на вхождение
adressвsubnet(в виде строк), однако в реальности алгоритм должен быть посложнее, пример
для входных аргументов["211.191.126.18","211.191.126.18/15"]результатtrue
Однако, если проверить в калькуляторе https://ip-calculator.ru/#!ip=211.191.126.18/15
адрес сети должен быть211.190.0.0(тут проявляется и 2 проблема, о ней ниже) - Генерация тестов не корректная, адрес подсети в тестовых данных должен генерироваться с учетом маски, в данный момент генерируется произвольный адрес, алгоритм генерации тестов должен быть следующий:
- 1 - генерируем маску подсети (m) в диапазоне от 0 до 32
- 2 - с учетом маски генерируем адрес подсети (используем первые m бит из 32, остальные биты - нулевые)
- 3 - случайным образом определяем должен ли адрес принадлежать подсети (с вероятностью 50%)
- 4 - на основании п.3 генерируем случайный ip-адрес гарантированно принадлежащий (или не принадлежащий) указанной подссети.
В связи с тем, что в данный момент генерация ip-адреса и адреса подсети производятся независимо друг от друга в большинстве тестов результат проверки будет false, соответственно тесты плохо проверяют корректность написанного кода.
- Dominant language
- Clojure
- Stars
- 71
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hexlet-codebattle/battle_asserts
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
hexlet-codebattle/battle_asserts#1093 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
hexlet-codebattle/battle_asserts#1072 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
hexlet-codebattle/battle_asserts#1036 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
hexlet-codebattle/battle_asserts#1001 · 1 comment ·
All issues in hexlet-codebattle/battle_asserts
Similar issues
-
Disable the admin-console by default in the devenv frontendPossibly taken @niwinz claimed this today. Openneeds triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
`sequence` does not accept a transducer with more than one collectionPossibly taken @burinc claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
.Needs Triage .Team/Graphy Priority:P3 Type:Bug
Difficulty 2/5 1-2 days Newbie friendliness 65/100
metabase/metabase#87126 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 Under an hour Newbie friendliness 70/100