Fixed the fail function

fail() function did not work. Tests failed. Updated and tested on Windows and Ubuntu.

Also adjusted some stuff to allow running the tests on windows using the added batch files.