-
Notifications
You must be signed in to change notification settings - Fork 980
/
TEST.cc
43 lines (37 loc) · 863 Bytes
/
TEST.cc
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define CATCH_CONFIG_MAIN
#include "../Catch/single_include/catch.hpp"
#include "solution.h"
TEST_CASE("First Missing Positive", "[firstMissingPositive]")
{
Solution s;
SECTION( "example1" )
{
int A[] = {1,2,0};
REQUIRE( s.firstMissingPositive(A, 3) == 3);
}
SECTION( "example2" )
{
int A[] = {3,4,-1,1};
REQUIRE( s.firstMissingPositive(A, 4) == 2);
}
SECTION( "empty" )
{
int A[] = {};
REQUIRE( s.firstMissingPositive(A, 0) == 1);
}
SECTION( "one" )
{
int A[] = {1};
REQUIRE( s.firstMissingPositive(A, 1) == 2);
}
SECTION( "one2" )
{
int A[] = {2};
REQUIRE( s.firstMissingPositive(A, 1) == 1);
}
SECTION( "repeat" )
{
int A[] = {1,1};
REQUIRE( s.firstMissingPositive(A, 2) == 2);
}
}