Question: [==========] Running 1 test from 1 test suite. 2 [----------] Global test environment set-up. 3 [----------] 1 test from MimirTest 4 [ RUN ] MimirTest.cppUnitTest

[==========] Running 1 test from 1 test suite.
2 [----------] Global test environment set-up.
3 [----------] 1 test from MimirTest
4 [ RUN ] MimirTest.cppUnitTest
5
6
7 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
8 Hello. Beginning Unit tests for the StringWrapper basic functionality.
9 Test 1: Test the StringWrapper constructor given an initial string.
10 Test 1 Completed OK.
11
12 Test 2: Test the `get()` accessor
13 Test 2 Completed OK.
14
15 Test 3: Test `readline()`
16
17 Enter a word: his is a test string.
18 Test 3: `readline() executed successfully; test the results
19 cpp_unit_test:44: Failure
20 Expected equality of these values:
21 str_b->get(0)
22 Which is: 'h' (104, 0x68)
23 'T'
24 Which is: 'T' (84, 0x54)
25 First character of the string (after `readline()`) was expected to
26 contain the character 'T', but the character 'h' was found instead.
27
28 [ FAILED ] MimirTest.cppUnitTest (0 ms)
29 [----------] 1 test from MimirTest (0 ms total)
30
31 [----------] Global test environment tear-down
32 [==========] 1 test from 1 test suite ran. (0 ms total)
33 [ PASSED ] 0 tests.
34 [ FAILED ] 1 test, listed below:
35 [ FAILED ] MimirTest.cppUnitTest
36
37 1 FAILED TEST
38

void StringWrapper::readline(std::istream& strm, char delim) { cout << " Enter a word: "; strm.ignore(); strm.getline(array, max_capacity, delim); int size = std::strlen(array); if (size >= max_capacity) { throw std::out_of_range{"Array index out of bounds."}; } write(); }

How can I fix this error?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!