forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_lextable.cpp
More file actions
69 lines (52 loc) · 1.83 KB
/
test_lextable.cpp
File metadata and controls
69 lines (52 loc) · 1.83 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
60
61
62
63
64
65
66
67
68
69
/* Copyright (C) 2003-2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
#include "gtest/gtest.h"
#include "prefix.h"
#include "parsedef.h"
#include "scriptpt.h"
TEST(lextable, constant_table)
//
// Checks that the entries of constant_table are in alphabetical order.
//
{
extern Cvalue constant_table[];
extern const uint4 constant_table_size;
ASSERT_GE(constant_table_size, (unsigned)1);
for(uint4 i = 0; i < constant_table_size - 1; i++) {
EXPECT_LT(strcmp(constant_table[i].token, constant_table[i+1].token), 0)
<< "\"" << constant_table[i+1].token << "\""
<< " comes before "
<< "\"" << constant_table[i].token << "\"";
}
}
TEST(lextable, table_pointer)
//
// Checks that the entries of factor_table are in alphabetical order.
//
{
extern LT *table_pointers[];
extern const uint4 table_pointers_size;
extern uint2 table_sizes[];
extern const uint4 table_sizes_size;
ASSERT_EQ(table_pointers_size, table_sizes_size);
for (uint4 i = 0; i < table_pointers_size; i++) {
LT* table = table_pointers[i];
const uint4 table_size = table_sizes[i];
ASSERT_GE(table_size, (unsigned)1);
for (uint4 j = 0; j < table_size - 1; j++) {
EXPECT_LT(strcmp(table[j].token, table[j+1].token), 0)
<< "\"" << table[j+1].token << "\""
<< " comes before "
<< "\"" << table[j].token << "\"";
}
}
}