Ad
  • Custom User Avatar

    Why did you republish it? This is a duplicate, you're losing your time (and the one of the beta testers)

  • Custom User Avatar

    Input parameter is misnamed: inputFile denotes a file, which should have a type like std::ifstream, but it's std::string, so it should not be called a file.

  • Custom User Avatar

    Tests cannot be run:

    In file included from main.cpp:7:
    ./tests.cpp:9:23: error: implicit instantiation of undefined template 'std::basic_ofstream<char, std::char_traits<char> >'
            std::ofstream file(inputFile);
                          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:119:11: note: template is declared here
        class basic_ofstream;
              ^
    In file included from main.cpp:7:
    ./tests.cpp:38:23: error: implicit instantiation of undefined template 'std::basic_ofstream<char, std::char_traits<char> >'
            std::ofstream file(inputFile);
                          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:119:11: note: template is declared here
        class basic_ofstream;
              ^
    In file included from main.cpp:7:
    ./tests.cpp:58:23: error: implicit instantiation of undefined template 'std::basic_ofstream<char, std::char_traits<char> >'
            std::ofstream file(inputFile);
                          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:119:11: note: template is declared here
        class basic_ofstream;
              ^
    In file included from main.cpp:7:
    ./tests.cpp:68:52: error: no member named 'setprecision' in namespace 'std'
                file << i << "," << std::fixed << std::setprecision(2) << measurement << "\n";
                                                  ~~~~~^
    ./tests.cpp:79:23: error: implicit instantiation of undefined template 'std::basic_ofstream<char, std::char_traits<char> >'
            std::ofstream file(inputFile);
                          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:119:11: note: template is declared here
        class basic_ofstream;
              ^
    In file included from main.cpp:7:
    ./tests.cpp:91:60: error: no member named 'setprecision' in namespace 'std'
                file << timestamp << "," << std::fixed << std::setprecision(2) << measurement << "\n";
                                                          ~~~~~^
    6 errors generated.
    

    On top of this, the user code and tests are not written properly; return type is void, and no test assertions exist.