-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathtesting.h
More file actions
92 lines (80 loc) · 3.9 KB
/
Copy pathtesting.h
File metadata and controls
92 lines (80 loc) · 3.9 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef _TESTINGH
#define _TESTINGH
#ifdef INFORMATION
Copyright (C)2011-2024 by Bruce Wilcox
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#define HAS_BREAKPOINTS 2
#define TESTING_REPEATALLOWED 1000
extern unsigned int priortrace;
extern bool ingest;
void InitStats();
extern char priorLogin[ID_SIZE];
#ifndef DISCARDTESTING
typedef void (*COMMANDPTR)(char* input);
typedef struct CommandInfo
{
char* word; // dictionary word entry
COMMANDPTR fn; // function to use to get it
char* comment; // what to say about it
} CommandInfo;
extern CommandInfo commandSet[];
extern int breakIndex;
TestMode Command(char* input,char* output,bool fromScript);
int CountSet(WORDP D,unsigned int baseStamp);
extern bool nomixedcase;
extern bool noconcept;
void Sortit(char* name,int oneline);
void SortTopic(WORDP D,uint64 junk);
void SortTopic0(WORDP D,uint64 junk);
void C_MemStats(char* input);
#endif
TestMode DoCommand(char* input,char* output,bool authorize=true);
bool VerifyAuthorization(FILE* in);
// Exposed for unit testing
struct IngestStruct {
char* readbuf; /* working buffer for parsing log entry */
char* originalbuf;
char* copybuf;
char* buffer; /* input to PerformChat parsed from log */
char expectedWhy[MAX_WORD_SIZE];
char actualWhy[MAX_WORD_SIZE];
char bot[MAX_WORD_SIZE];
char lastCategory[100]; // for tcp files, what is volley starting category
char lastSpecialty[100]; // for tcp files, what is volley starting specialty
char apiinput[5000]; // what is user input embedded in api call
char* prior1; // for tcp, the message just before this one
char* prior2; // for tcp, the message 2 back from this one
char user[MAX_WORD_SIZE];
char ip[100];
char label[MAX_WORD_SIZE];
char topic[MAX_WORD_SIZE];
char turn[100];
char username[100]; // override
char* actualOutBuffer; /* buffer for performchat to use for output*/
char* expectedOutput; /* cleaned version from log */
char* actualOutput; /* cleaned version from PerformChat */
char* preexpectedOutput; /* cleaned version from log */
char* preactualOutput; /* cleaned version from PerformChat */
bool tcpfile; /* is tcp volley rather than integration or dse */
bool rbetvolley; // seen some rbet marker
uint64 starttime;
int ingestLineCount; // what line are we on (to skip or process)
int ingestErrorCount; // how many real errors detected
int ingestSkip; // how many initial lines to not process
int ingesttraceline; // when to start tracing for 2 lines
int ingestLineLimit; // how many lines to actually analyze
int ingestChatCount; // this is the ith message we have actually processed with performchat
int ignored;
};
void mallocIngestStruct(IngestStruct& is, int limit);
void freeIngestStruct(IngestStruct& is);
bool parseIngestLogEntry(IngestStruct& is);
char* CleanLogEntry(char* output);
#endif