-
Notifications
You must be signed in to change notification settings - Fork 963
Expand file tree
/
Copy pathTEST.cc
More file actions
25 lines (24 loc) · 683 Bytes
/
TEST.cc
File metadata and controls
25 lines (24 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define CATCH_CONFIG_MAIN
#include "../Catch/single_include/catch.hpp"
#include "solution.h"
TEST_CASE("Implement strStr()", "[strStr]")
{
Solution s;
SECTION( "empty" )
{
char haystack[] = "";
char needle[] = "";
char other[] = "something";
REQUIRE( s.strStr(haystack, needle) == 0 );
REQUIRE( s.strStr(haystack, other) == -1 );
REQUIRE( s.strStr(other, needle) == 0 );
}
SECTION( "common" )
{
char haystack[] = "whoisyourdady";
char needle[] = "your";
char other[] = "p";
REQUIRE( s.strStr(haystack, needle) == 5 );
REQUIRE( s.strStr(haystack, other) == -1 );
}
}