Menu

[3c79ba]: / tests / tests-replace.cpp  Maximize  Restore  History

Download this file

20 lines (16 with data), 552 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include "catch.hpp"
#include <string>
#include "../src/replace.h"
TEST_CASE( "replace works as specified", "[replace]" ) {
std::string orig = "when shall we three meet again";
std::string find = "THREE";
std::string replace = "four";
// case insensitive
std::string buf = orig;
REQUIRE( Replace::run(buf, find, replace, false) == 1 );
REQUIRE( buf == "when shall we four meet again" );
// case sensitive
buf = orig;
REQUIRE( Replace::run(buf, find, replace, true) == 0 );
REQUIRE( buf == "when shall we three meet again" );
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.