egeldenhuys / black-fitch

[DEPRECATED] Black-box Unit Tests for Fitchfork practicals and assignments
GNU General Public License v3.0
8 stars 4 forks source link

Assignment 3 - Task 2: Error not detected by Black Fitch #40

Closed MrHerbs closed 8 years ago

MrHerbs commented 8 years ago

Fitchfork:

Compile WARNING => Possible compile warnings and/or errors follow, try to get rid of them.
In file included from circularList.h:110:0,
                 from ccListTest.cpp:2:
circularList.cpp: In instantiation of 'CircularList<T>& CircularList<T>::operator=(const CircularList<T>&) [with T = std::__cxx11::basic_string<char>]':
ccListTest.cpp:190:10:   required from here
circularList.cpp:204:31: error: cannot convert 'CircularList<T>::getLeader<std::__cxx11::basic_string<char> >' from type 'Node<std::__cxx11::basic_string<char> >* (CircularList<std::__cxx11::basic_string<char> >::)() const' to type 'Node<std::__cxx11::basic_string<char> >*'
  for (Node<T> *ptrNew = other.getLeader; ptrNew != NULL; ptrNew = ptrNew->next)
                               ^
makefile:5: recipe for target 'ccListTest.o' failed
make: *** [ccListTest.o] Error 1

Compile FAILURE

EXCEPTION raised trying to run assignment: Executable not set
This is due to the WARNINGS, ERRORS and/or FAILURES shown above, which you have to fix before continuing.
MrHerbs commented 8 years ago

Extract from given ccListTest.cpp:

    CircularList<int> cclist1;
    // Add elements to cclist1
    CircularList<int>* cclist2 = new CircularList<int>(cclist1);
    cclist1 = *cclist2;

Related Black Fitch test case:

TEST_CASE("testing CircularList<int> assignment operator", "[task2]") {
  CircularList<int> *ll1 = new CircularList<int>();

  ll1->insert(0, 1);
  ll1->insert(1, 2);
  ll1->insert(2, 3);

  CircularList<int> *ll2 = new CircularList<int>();
  ll2->insert(0, 9);

  ll2 = ll1;

  ostringstream result;
  result << "[1,2,3]";

  ostringstream output;
  captureDisplay(ll2, output);

  REQUIRE(output.str() == result.str());
  REQUIRE(testTailPointsToHead(ll2) == true);
}

ll2 = ll1; should be `ll2 = ll1', otherwise we are simply assigning one pointer value to another.

I will fix and send a pull request.