forked from pezy/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEST.cc
53 lines (43 loc) · 1.02 KB
/
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
44
45
46
47
48
49
#define CATCH_CONFIG_MAIN
#include "../Catch/single_include/catch.hpp"
#include "solution.h"
#include <iostream>
TEST_CASE("remove elements of an array", "[removeElement]")
{
SECTION( "1" )
{
int arr[] = {1,3,4,5,3,6,8,9};
Solution s;
REQUIRE( s.removeElement(arr, 8, 3) == 6 );
}
SECTION( "2" )
{
int arr[] = {4,2,0,2,2,1,4,4,1,4,3,2};
Solution s;
REQUIRE( s.removeElement(arr, 12, 4) == 8 );
}
SECTION( "3" )
{
int arr[] = {0,3,1,1,0,1,3,0,3,3,1,1};
Solution s;
REQUIRE( s.removeElement(arr, 12, 1) == 7 );
}
SECTION( "3" )
{
int arr[] = {1};
Solution s;
REQUIRE( s.removeElement(arr, 1, 1) == 0 );
}
SECTION( "4" )
{
int arr[] = {2,2,3};
Solution s;
REQUIRE( s.removeElement(arr, 3, 3) == 2 );
}
SECTION( "5" )
{
int arr[] = {3,3};
Solution s;
REQUIRE( s.removeElement(arr, 2, 3) == 0 );
}
}