When you pass from 10 base to other you make successive divisions. For example pass 5 base 10 to base 2 you result with 1 0 1. All fine. But if you have 0 in base 10 to pass it to base 4 (or whatever > 0), you divide 0 between 4 (or whatever > 0) and the quotient and residue is 0. Hence 0 base 10 = 0 base 4 (or whatever > 0). Saying this, in one of test of this problem exist the next code:
I will consult how since the application is necessary. I saw the same problem in tcl but didn’t report it, just made the program pass the test to move on.
Thanks @IsaacG, I want make it but I am a newbie in this works. I have to review how it works. I am now lose: I forked the problem-specification, Do I have to fork bash too?
This looks good so far! The updated test looks much better.
However, all the exercises have an example solution. If the tests change, the example may also need to change so the example solution still passes.
» ./bin/validate_one_exercise exercises/practice/all-your-base
Processing all-your-base
✓ single bit to one decimal
✓ binary to single decimal
✓ single decimal to binary
✓ binary to multiple decimal
✓ decimal to binary
✓ trinary to hexadecimal
✓ hexadecimal to trinary
✓ 15 bit integer
✓ empty list
✗ single zero
(from function `assert_output' in file bats-extra.bash, line 394,
in test file all_your_base.bats, line 73)
`assert_output "0"' failed
-- output differs --
expected : 0
actual :
--
✗ multiple zeroes
(from function `assert_output' in file bats-extra.bash, line 394,
in test file all_your_base.bats, line 80)
`assert_output "0"' failed
-- output differs --
expected : 0
actual :
--
The example solution lives at exercises/practice/all-your-base/.meta/example.sh
Thanks @IsaacG I make the change. For now I am trying to locate me in git from console with the help of @kotp (I am reviewing the complete extra rapid course that he gives me yesterday).