diff options
Diffstat (limited to 'indra/test/llstreamtools_tut.cpp')
-rw-r--r-- | indra/test/llstreamtools_tut.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp index 68e56b5ee2..a9bb15d911 100644 --- a/indra/test/llstreamtools_tut.cpp +++ b/indra/test/llstreamtools_tut.cpp @@ -385,17 +385,16 @@ namespace tut std::string expected_result; std::string actual_result; std::istringstream is; - bool ret; is.clear(); is.str(str = " First Second \t \r \n Third Fourth-ShouldThisBePartOfFourth Fifth\n"); actual_result = ""; - ret = get_word(actual_result, is); // First + get_word(actual_result, is); // First (void)ret; actual_result = ""; - ret = get_word(actual_result, is); // Second + get_word(actual_result, is); // Second (void)ret; actual_result = ""; - ret = get_word(actual_result, is); // Third + get_word(actual_result, is); // Third (void)ret; // the current implementation of get_word seems inconsistent with @@ -405,22 +404,22 @@ namespace tut // carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v') // as delimiters actual_result = ""; - ret = get_word(actual_result, is); // will copy Fourth-ShouldThisBePartOfFourth + get_word(actual_result, is); // will copy Fourth-ShouldThisBePartOfFourth actual_result = ""; - ret = get_word(actual_result, is); // will copy Fifth + get_word(actual_result, is); // will copy Fifth is.clear(); is.str(str = " First Second \t \r \n Third Fourth_ShouldThisBePartOfFourth Fifth\n"); - ret = skip_to_next_word(is); // should now point to First - ret = skip_to_next_word(is); // should now point to Second - ret = skip_to_next_word(is); // should now point to Third - ret = skip_to_next_word(is); // should now point to Fourth - ret = skip_to_next_word(is); // should now point to ShouldThisBePartOfFourth + skip_to_next_word(is); // should now point to First + skip_to_next_word(is); // should now point to Second + skip_to_next_word(is); // should now point to Third + skip_to_next_word(is); // should now point to Fourth + skip_to_next_word(is); // should now point to ShouldThisBePartOfFourth expected_result = ""; // will copy ShouldThisBePartOfFourth, the fifth word, // while using get_word above five times result in getting "Fifth" - ret = get_word(expected_result, is); + get_word(expected_result, is); ensure_equals("get_word: skip_to_next_word compatibility", actual_result, expected_result); } @@ -482,40 +481,39 @@ namespace tut std::string expected_result; std::string actual_result; std::istringstream is; - bool ret; is.clear(); is.str(str = "First Second \t \r\n Third Fourth-ShouldThisBePartOfFourth IsThisFifth\n"); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); (void)ret; expected_result = "First Second \t \r\n"; ensure_equals("get_line: 1", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); expected_result = " Third Fourth-ShouldThisBePartOfFourth IsThisFifth\n"; ensure_equals("get_line: 2", actual_result, expected_result); is.clear(); is.str(str = "\nFirst Line.\n\nSecond Line.\n"); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); expected_result = "\n"; ensure_equals("get_line: First char as newline", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); expected_result = "First Line.\n"; ensure_equals("get_line: 3", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); expected_result = "\n"; ensure_equals("get_line: 4", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); expected_result = "Second Line.\n"; ensure_equals("get_line: 5", actual_result, expected_result); } @@ -547,13 +545,12 @@ namespace tut std::string expected_result; std::string actual_result; std::istringstream is; - bool ret; // need to be check if this test case is wrong or the implementation is wrong. is.clear(); is.str(str = "Should not skip lone \r.\r\n"); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); (void)ret; expected_result = "Should not skip lone \r.\r\n"; ensure_equals("get_line: carriage return skipped even though not followed by newline", actual_result, expected_result); @@ -567,12 +564,11 @@ namespace tut std::string expected_result; std::string actual_result; std::istringstream is; - bool ret; is.clear(); is.str(str = "\n"); actual_result = ""; - ret = get_line(actual_result, is); + get_line(actual_result, is); (void)ret; expected_result = "\n"; ensure_equals("get_line: Just newline", actual_result, expected_result); @@ -587,37 +583,36 @@ namespace tut std::string expected_result; std::string actual_result; std::istringstream is; - bool ret; is.clear(); is.str(str = "First Line.\nSecond Line.\n"); actual_result = ""; - ret = get_line(actual_result, is, 255); + get_line(actual_result, is, 255); (void)ret; expected_result = "First Line.\n"; ensure_equals("get_line: Basic Operation", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is, sizeof("Second")-1); + get_line(actual_result, is, sizeof("Second")-1); expected_result = "Second\n"; ensure_equals("get_line: Insufficient length 1", actual_result, expected_result); actual_result = ""; - ret = get_line(actual_result, is, 255); + get_line(actual_result, is, 255); expected_result = " Line.\n"; ensure_equals("get_line: Remainder after earlier insufficient length", actual_result, expected_result); is.clear(); is.str(str = "One Line only with no newline with limited length"); actual_result = ""; - ret = get_line(actual_result, is, sizeof("One Line only with no newline with limited length")-1); + get_line(actual_result, is, sizeof("One Line only with no newline with limited length")-1); expected_result = "One Line only with no newline with limited length\n"; ensure_equals("get_line: No newline with limited length", actual_result, expected_result); is.clear(); is.str(str = "One Line only with no newline"); actual_result = ""; - ret = get_line(actual_result, is, 255); + get_line(actual_result, is, 255); expected_result = "One Line only with no newline"; ensure_equals("get_line: No newline", actual_result, expected_result); } |