Closed snowfrogdev closed 2 years ago
Hey @snowfrogdev
The problem is with your input on the png
type.
Your input is
<<0x89, 0x50, 0x4E, 0x47, _rest::binary>>
But the analyser expects at least these hexadecimals
<<0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A>>
You can see the test here: https://github.com/exercism/elixir-analyzer/blob/706843e21384efc6c2842dc6213d885d9d0ba63b/lib/elixir_analyzer/test_suite/file_sniffer.ex#L33
Yeah, I cheated there, for formatting purposes. I figured I didn't need all of it to pass the exercise tests. 😁 So maybe we should modify the exercise tests so that they fail if the entire set of hexadecimals is not used?
Ah, that makes sense, the problem is in the tests, I will take a look :smile:
Resolved in https://github.com/exercism/elixir/pull/1155
Here is my solution:
And here is the message I get from the analyzer:
Even though there could be other valid ways to solve this exercise, for the sake of mastering bitstrings please match the first few bytes of the argument of
type_from_binary/1
with the special form<<>>
.It seems to me like that is exactly what I'm doing.