Skip to content

datafile_test.cpp has broken unit tests #1

@Jay2645

Description

@Jay2645

In datafile_test.cpp, there are 2 occurrences where assert is called, but rather than pass in the threw variable, instead assert is called with the constant true, which will cause the test to always succeed.

{
    bool threw = false;
    try {
      load_products("not a filename");
    } catch (runtime_error e) {
      threw = true;
    }
    assert(true);
  }

  cout << "Invalid file format" << endl;
  {
    bool threw = false;
    try {
      load_products("datafile.hpp");
    } catch (runtime_error e) {
      threw = true;
    }
    assert(true);
  }

This section of the code isn't part of anything that will affect the project as a whole (as the code this is testing is given), but it's still something which should be looked at.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions