-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathtest_scriptCompile.cpp
More file actions
61 lines (48 loc) · 1.3 KB
/
Copy pathtest_scriptCompile.cpp
File metadata and controls
61 lines (48 loc) · 1.3 KB
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
50
51
52
53
54
55
56
57
58
59
#include <cassert>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "timer.h"
#include "catch2.h"
#include <stddef.h>
#ifdef __GNUC__ // ignore warnings from common.h
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wconversion-null"
#include "../common.h"
#pragma GCC diagnostic pop
#else // not __GNUC__ means Visual Studio
#include "../common.h"
#endif // __GNUC__
#include "../scriptCompile.h"
// #define SKIP_TEST = 1
extern char* readBuffer;
#ifndef SKIP_TEST
TEST_CASE("compile_pattern", "[scriptCompile]")
{
char ptr[] = "#! Output comment !#\\nHello!";
char word[512];
char emptyBuffer[512];
readBuffer = emptyBuffer;
word[0] = '\0';
csapicall = COMPILE_PATTERN;
char* rv = ReadSystemToken(ptr, word);
char* expected = "Hello!";
REQUIRE(strcmp(expected, word) == 0);
}
#endif // SKIP_TEST
#ifndef SKIP_TEST
TEST_CASE("compile_output", "[scriptCompile]")
{
char ptr[] = "#! Output comment !#\\nHello!";
char word[512];
char emptyBuffer[512];
readBuffer = emptyBuffer;
word[0] = '\0';
csapicall = COMPILE_OUTPUT;
char* rv = ReadSystemToken(ptr, word);
char* expected = "Hello!";
REQUIRE(strcmp(expected, word) == 0);
}
#endif // SKIP_TEST