Build a Periodic Table Database: some test don't pass

I already done the project and made all the tests pass unless this two:

  • If you run ./element.sh 1, ./element.sh H, or ./element.sh Hydrogen, it should output The element with atomic number 1 is Hydrogen (H). It's a nonmetal, with a mass of 1.008 amu. Hydrogen has a melting point of -259.1 celsius and a boiling point of -252.9 celsius.

  • If you run ./element.sh script with another element as input, you should get the same output but with information associated with the given element.

Here is a screenshot with the terminal output , where you can check that it is exactly what the tests ask for.

Anyone knows how to solve? Thanks in advance guys.

Instead of checking visually that you have the correct answer, try to pipe everything into a file and use diff to compare it against the expected answer (I assume you have the expected answers provided to you somewhere)

The diff command helped me to find what was missing on my output.
In fact, the answer was correct, but checking with the diff command I got a 1c1 output, which stands for differences on whitespaces, end of lines or special characters.
I was adding a end of line that was not suposed to be there. Removing it solved the problem.
Thanks for the help! :two_hearts:

1 Like