-
Notifications
You must be signed in to change notification settings - Fork 1
/
t4.cpp
48 lines (38 loc) · 1023 Bytes
/
t4.cpp
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
#include <iostream>
#include <vector>
#include <algorithm>
#include <memory>
#include "helpers.h"
#include "test.hpp"
/* testing implementation of reverse */
#define NUM_TESTS 1.0
#ifndef TEST_NAME
#define TEST_NAME "Test0"
#pragma message ( "TEST_NAME is not defined" )
#endif
#ifndef MAX_POINTS
#define MAX_POINTS 17.0
#pragma message ( "MAX_POINTS is not defined" )
#endif
#define TEST_NAME "Test4"
#define TEST_DESC "testing implementation of reverse"
int correct=0;
#define m(x) std::make_unique<int>(x)
TEST_CASE("Test1", "1") {
std::vector<int> v {1,9,3,4,2,2,2,5,2};
std::vector<int> u=v;
::reverse(v.begin(),v.end());
std::reverse(u.begin(),u.end());
CHECKED_IF(u==v){
++correct;
}
std::cout<<"\n"<<TOKEN<<TEST_NAME<<"("<<TEST_DESC<<"):";
#ifdef PARTIAL
std::cout<<(correct* MAX_POINTS/NUM_TESTS)
<<"/"<<MAX_POINTS<<std::endl;
#else
if(correct==NUM_TESTS)
std::cout<<MAX_POINTS<<"/"<<MAX_POINTS<<std::endl;
else std::cout<<"0/"<<MAX_POINTS<<std::endl;
#endif
}