Skip to content

Commit 09d19c2

Browse files
rickrick
rick
authored and
rick
committed
improve libforks test case a bit
1 parent 0b80b00 commit 09d19c2

File tree

203 files changed

+362
-725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+362
-725
lines changed

blocks-test/blocks-test.c

+15-14
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,26 @@ struct PARSER_OP_s {
4646
PARSER_OP_b op;
4747
char *regex_pattern;
4848
bool *regex_match;
49-
int regex_match_start;
50-
int regex_match_length;
49+
int regex_match_start;
50+
int regex_match_length;
5151
char *wc_pattern;
5252
char *regex_extracted_chars;
5353
bool wc_match;
5454
};
5555
struct PARSER_OP_s parser_ops[] = {
5656
[PARSER_TYPE_1] = {
57-
.op = ^ int (int a, int b){ return(a - b); },
58-
.wc_pattern = "ello*",
59-
.regex_pattern = "[Hh]ello\\s.*[Ww]orld",
60-
.regex_match_start = 0, .regex_match_length = 0,
57+
.op = ^ int (int a, int b){ return(a - b); },
58+
.wc_pattern = "ello*",
59+
.regex_pattern = "[Hh]ello\\s.*[Ww]orld",
60+
.regex_match_start = 0, .regex_match_length = 0,
6161
.regex_extracted_chars = NULL,
6262
},
63-
[PARSER_TYPES_QTY] = { 0 },
63+
[PARSER_TYPES_QTY] = { 0 },
6464
};
65-
char *search_strings[] = {
65+
char *search_strings[] = {
6666
"Hello world",
6767
"''hello world",
68+
"''hello world",
6869
"ahem.. 'hello\t\nWorld !' ..",
6970
".... 'Hello world ..........",
7071
NULL,
@@ -78,10 +79,10 @@ TEST t_blocks_test_parser_ops(void){
7879

7980
printf("["AC_BLUE "%s" AC_RESETALL "]\n", strdup_escaped(search_string));
8081
for (size_t i = 0; i < PARSER_TYPES_QTY; i++) {
81-
parser_ops[i].wc_match = wildcardcmp(parser_ops[i].wc_pattern, search_string);
82-
parser_ops[i].regex_match_start = re_match(parser_ops[i].regex_pattern, search_string, &parser_ops[i].regex_match_length);
83-
parser_ops[i].regex_extracted_chars = (parser_ops[i].regex_match_start > 0)
84-
? stringfn_substring(search_string,parser_ops[i].regex_match_start,parser_ops[i].regex_match_length)
82+
parser_ops[i].wc_match = wildcardcmp(parser_ops[i].wc_pattern, search_string);
83+
parser_ops[i].regex_match_start = re_match(parser_ops[i].regex_pattern, search_string, &parser_ops[i].regex_match_length);
84+
parser_ops[i].regex_extracted_chars = (parser_ops[i].regex_match_start > 0)
85+
? stringfn_substring(search_string, parser_ops[i].regex_match_start, parser_ops[i].regex_match_length)
8586
: NULL;
8687

8788
printf(AC_YELLOW "\tParser #%lu> Wildcard: %s%s\n" AC_RESETALL,
@@ -91,12 +92,12 @@ TEST t_blocks_test_parser_ops(void){
9192
);
9293
printf(AC_MAGENTA "\tParser #%lu> Regex: %s(%s) %s :: (chars %d-%d): " AC_RESETALL AC_CYAN "%s" AC_RESETALL "\n" AC_RESETALL,
9394
i,
94-
(parser_ops[i].regex_match_start>0) ? AC_GREEN : AC_RED,
95+
(parser_ops[i].regex_match_start > 0) ? AC_GREEN : AC_RED,
9596
parser_ops[i].regex_pattern,
9697
(parser_ops[i].regex_match_start > 0) ? "Yes" : "No",
9798
(parser_ops[i].regex_match_start > 0) ? (parser_ops[i].regex_match_start) : 0,
9899
(parser_ops[i].regex_match_start > 0) ? (parser_ops[i].regex_match_length) : 0,
99-
(parser_ops[i].regex_match_start > 0)
100+
(parser_ops[i].regex_match_start > 0)
100101
? (strdup_escaped(parser_ops[i].regex_extracted_chars))
101102
: ""
102103
);

blocks-test/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ blocks_test_include_dirs = [
77
inc,
88
]
99
blocks_test_deps = [
10+
wildcardcmp_dep,
11+
tiny_regex_c_dep,
12+
tinydir_dep,
13+
ansi_utils_dep,
1014
c_greatest_dep,
1115
c_vector_dep,
1216
c_fsio_dep,

c-meson-utils-test/c-meson-utils-test.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
#include "c_fsio/include/fsio.h"
1515
#include "jinja2-cli/jinja2-cli.h"
1616
#include "tempdir.c/tempdir.h"
17-
//////////////////////////////////////////////
18-
1917

18+
//////////////////////////////////////////////
2019
char *RENDER_TEMPLATE_VARS(char *TEMPLATE_s, char *VARS_s, char *COLOR){
2120
struct jinja2_render_template_t *c = jinja2_init_config();
2221

@@ -156,7 +155,6 @@ SUITE(s_c_meson_utils_render_test_executable){
156155

157156
GREATEST_MAIN_DEFS();
158157

159-
160158
int main(int argc, char **argv) {
161159
GREATEST_MAIN_BEGIN();
162160
(void)argc; (void)argv;
@@ -169,4 +167,3 @@ int main(int argc, char **argv) {
169167
GREATEST_MAIN_END();
170168
return(0);
171169
}
172-

c-meson-utils-test/c-meson-utils-test.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
#include <string.h>
2020
#include <string.h>
2121
#include <sys/time.h>
22-

cgif-test/cgif-test.c

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define WIDTH 1024
88
#define HEIGHT 1024
99

10-
1110
/* Small helper functions to initialize GIF- and frame-configuration */
1211
static void initGIFConfig(CGIF_Config *pConfig, char *path, uint16_t width, uint16_t height, uint8_t *pPalette, uint16_t numColors) {
1312
memset(pConfig, 0, sizeof(CGIF_Config));
@@ -18,13 +17,11 @@ static void initGIFConfig(CGIF_Config *pConfig, char *path, uint16_t width, uint
1817
pConfig->path = path;
1918
}
2019

21-
2220
static void initFrameConfig(CGIF_FrameConfig *pConfig, uint8_t *pImageData) {
2321
memset(pConfig, 0, sizeof(CGIF_FrameConfig));
2422
pConfig->pImageData = pImageData;
2523
}
2624

27-
2825
/* This is an example code that creates a GIF-image with random pixels. */
2926
int main(void) {
3027
CGIF *pGIF; // struct containing the GIF

chan-test/chan-test.c

-7
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ worker_t *workers;
6161
volatile int processed_jobs_qty = 0, processed_qtys[1024];
6262
chan_t *JOBS_CHANNEL, *DONE_CHANNEL;
6363

64-
6564
void *worker(void *WID){
6665
void *job;
6766
int processed_qty = 0;
@@ -99,12 +98,10 @@ void *worker(void *WID){
9998
return(NULL);
10099
}
101100

102-
103101
void init_workers(size_t WORKERS_QTY){
104102
workers = malloc(sizeof(worker_t) * WORKERS_QTY);
105103
}
106104

107-
108105
TEST t_free_workers(){
109106
if (workers) {
110107
free(workers);
@@ -115,15 +112,13 @@ TEST t_free_workers(){
115112
PASS();
116113
}
117114

118-
119115
TEST t_init_workers(void *workers_qty){
120116
init_workers((size_t)workers_qty);
121117
ASSERT_NEQ(workers, NULL);
122118

123119
PASS();
124120
}
125121

126-
127122
TEST t_chan_jobs_worker(void *buffer_qty,
128123
void *workers_qty,
129124
void *send_jobs_delay_ms,
@@ -201,12 +196,10 @@ TEST t_chan_jobs_worker(void *buffer_qty,
201196
CREATE_JOBS_SUITES()
202197
GREATEST_MAIN_DEFS();
203198

204-
205199
int main(int argc, char **argv) {
206200
//ct_set_unit(ct_MILLISECONDS);
207201
GREATEST_MAIN_BEGIN();
208202
RUN_TEST_SUITES();
209203
GREATEST_MAIN_END();
210204
return(0);
211205
}
212-

ctable/ctable-main.c

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ static Test (*test_getters[])() = {
1111
get_table_test,
1212
};
1313

14-
1514
int main(){
1615
Table table = get_empty_table();
1716

ctable/ctable-test.c

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ char *arrayA[4][4] = {
1919
{ " 3....... ", RED " 23.1132310 " COL_RESET, "c ", " 333" },
2020
};
2121

22-
2322
bool table_test(__attribute__((unused)) Vector *error_builder){
2423
// Case 1
2524
Table t1 = get_empty_table();
@@ -114,7 +113,6 @@ bool table_test(__attribute__((unused)) Vector *error_builder){
114113
return(true);
115114
} /* table_test */
116115

117-
118116
Test get_table_test(){
119117
return((Test){
120118
table_test,

dbgp-test/dbgp-test.c

-10
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ char msg0[1024 * 2];
5454
#define JOBS_QTY 45500
5555
#define WORKER_SLEEP_MS 100
5656

57-
5857
/////////////////////////////////////////////////////////////
5958
void *worker(void *WID){
6059
void *job;
@@ -120,7 +119,6 @@ void *worker(void *WID){
120119
return(NULL);
121120
} /* worker */
122121

123-
124122
void test_send_channel(void){
125123
char *sent_dur;
126124

@@ -148,7 +146,6 @@ void test_send_channel(void){
148146
free(sent_dur);
149147
}
150148

151-
152149
void test_setup_channels(void){
153150
JOBS_CHANNEL = chan_init(BUFFER_QTY);
154151
DONE_CHANNEL = chan_init(0);
@@ -160,7 +157,6 @@ void test_setup_channels(void){
160157
ASSERT_EQ(0, res);
161158
}
162159

163-
164160
TEST test_dbgp(void){
165161
dbgp_main();
166162
PASS();
@@ -173,15 +169,13 @@ SUITE(dbgp) {
173169

174170
GREATEST_MAIN_DEFS();
175171

176-
177172
int main(int argc, char **argv) {
178173
GREATEST_MAIN_BEGIN();
179174
//RUN_SUITE(dbgp);
180175
GREATEST_MAIN_END();
181176
return(0);
182177
}
183178

184-
185179
void screenshot(SDL_Renderer *renderer, const char *filename) {
186180
int width = 0;
187181
int height = 0;
@@ -198,7 +192,6 @@ void screenshot(SDL_Renderer *renderer, const char *filename) {
198192
SDL_FreeSurface(screenshot);
199193
}
200194

201-
202195
void render_screen(void){
203196
SDL_SetRenderDrawColor(renderer, 0x30, 0x30, 0x30, 0xff);
204197
SDL_RenderClear(renderer);
@@ -244,7 +237,6 @@ void render_screen(void){
244237
SDL_RenderPresent(renderer);
245238
} /* render_screen */
246239

247-
248240
int dbgp_main(void) {
249241
pthread_t th;
250242

@@ -282,15 +274,13 @@ int dbgp_main(void) {
282274
return(1);
283275
}
284276

285-
286277
if (DBGP_OpenFont(
287278
&unscii8, renderer, DBGP_UNSCII8, sizeof(DBGP_UNSCII8),
288279
DBGP_UNSCII8_WIDTH, DBGP_UNSCII8_HEIGHT) != 0) {
289280
SDL_Log("Unable to initialise DBGP_UNSCII8: %s", SDL_GetError());
290281
return(1);
291282
}
292283

293-
294284
fprintf(stderr,
295285
"\n**OPTIONS**\n\n"
296286
"Screenshot: s\n"

dbgp-test/dbgp-test.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919
#include "submodules/SDL_DBGP/SDL_DBGP.h"
2020
#include "submodules/timestamp/timestamp.h"
2121

22-
2322
typedef struct WORKER_T {
2423
int delay_ms;
2524
int thread_index;
2625
char msg[1024];
2726
} worker_t;
2827

29-
3028
int dbgp_main(void);
29+
3130
void render_screen(void);

0 commit comments

Comments
 (0)