Compare commits

...

2 commits

Author SHA1 Message Date
3fc301cde5 Update Changelog.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 22s
2024-11-21 14:06:09 +09:00
82693bfa3e Ensure http_template.c keeps track of _FILE files 2024-11-21 14:05:33 +09:00
9 changed files with 106 additions and 75 deletions

View file

@ -4,16 +4,17 @@
Implemented "IF", "ELSEIF", "ELSE", "ENDIF", and "INDEX" for templates. Implemented "IF", "ELSEIF", "ELSE", "ENDIF", and "INDEX" for templates.
IF is used like: `{{{!IF Variable==SomeString}}}`. IF is used like: `{{{!IF Variable==SomeString}}}`.
ELSEIF is used like: `{{{!ELSEIF Variable==AnotherString}}}`. ELSEIF is used like: `{{{!ELSEIF Variable==AnotherString}}}`.
ELSE is used like: `{{{!ELSE}}}`. ELSE is used like: `{{{!ELSE}}}`.
ENDIF is used like: `{{{!ENDIF}}}`. ENDIF is used like: `{{{!ENDIF}}}`.
INDEX is used like: `{{{!INDEX ArrayVar[2]}}}`. INDEX is used like: `{{{!INDEX ArrayVar[2]}}}`.
Implemented "FOREACH" and "ENDFOREACH" for templates. Implemented "FOREACH" and "ENDFOREACH" for templates.
FOREACH is used like: FOREACH is used like:
PATH=/
HTML=''' HTML='''
{{{!FOREACH ArrayVar}}} {{{!FOREACH ArrayVar}}}
{{{ArrayVar}}} {{{ArrayVar}}}
@ -24,6 +25,7 @@ FOREACH is used like:
For multiple variables to expand in FOREACH: For multiple variables to expand in FOREACH:
PATH=/
HTML=''' HTML='''
{{{!FOREACH ArrayVar!ArrayVarSecond!ArrayVarThird}}} {{{!FOREACH ArrayVar!ArrayVarSecond!ArrayVarThird}}}
{{{ArrayVar}}} {{{ArrayVar}}}

View file

@ -0,0 +1 @@
<b>Each File ONE</b><br>

View file

@ -0,0 +1 @@
<b>Each File TWO</b><br>

View file

@ -0,0 +1 @@
<b>Each File ZERO</b><br>

View file

@ -100,6 +100,9 @@ Nested FOREACH:<br>
{{{ArrayValueThird}}} {{{ArrayValueThird}}}
{{{!FOREACH ArrayValueFourth}}} {{{!FOREACH ArrayValueFourth}}}
{{{ArrayValueFourth}}} {{{ArrayValueFourth}}}
{{{!FOREACH Each_FILE}}}
{{{Each_FILE}}}
{{{!ENDFOREACH}}}
{{{!ENDFOREACH}}} {{{!ENDFOREACH}}}
{{{!ENDFOREACH}}} {{{!ENDFOREACH}}}
{{{!ENDFOREACH}}} {{{!ENDFOREACH}}}
@ -143,6 +146,10 @@ EachTestHead='''Third Entry Head'''
EachTestMid='''Third Entry Mid''' EachTestMid='''Third Entry Mid'''
EachTestTail='''Third Entry Tail''' EachTestTail='''Third Entry Tail'''
Each_FILE='''example_config/each_file_zero.html'''
Each_FILE='''example_config/each_file_one.html'''
Each_FILE='''example_config/each_file_two.html'''
PATH=/inner PATH=/inner
HTML_FILE='''example_config/inner.html''' HTML_FILE='''example_config/inner.html'''
VAR_FILE='''example_config/var.html''' VAR_FILE='''example_config/var.html'''

View file

@ -38,8 +38,12 @@
#include "helpers.h" #include "helpers.h"
#include "http_template.h" #include "http_template.h"
int c_simple_http_internal_write_filenames_to_cache_file(void *data, void *ud) { int c_simple_http_internal_write_filenames_to_cache_file(
char *filename = data; const void *key,
__attribute__((unused)) size_t key_size,
__attribute__((unused)) const void *value,
void *ud) {
const char *filename = key;
FILE *cache_fd = ud; FILE *cache_fd = ud;
const size_t filename_size = strlen(filename); const size_t filename_size = strlen(filename);
@ -436,8 +440,8 @@ CACHE_FILE_WRITE_CHECK:
return -5; return -5;
} }
__attribute__((cleanup(simple_archiver_list_free))) __attribute__((cleanup(simple_archiver_hash_map_free)))
SDArchiverLinkedList *used_filenames = NULL; SDArchiverHashMap *used_filenames = NULL;
size_t generated_html_size = 0; size_t generated_html_size = 0;
@ -452,10 +456,10 @@ CACHE_FILE_WRITE_CHECK:
return -4; return -4;
} }
if (simple_archiver_list_get( if (simple_archiver_hash_map_iter(
used_filenames, used_filenames,
c_simple_http_internal_write_filenames_to_cache_file, c_simple_http_internal_write_filenames_to_cache_file,
cache_fd)) { cache_fd) != 0) {
fprintf(stderr, "ERROR Failed to write filenames to cache file!\n"); fprintf(stderr, "ERROR Failed to write filenames to cache file!\n");
return -6; return -6;
} else if (fwrite("--- BEGIN HTML ---\n", 1, 19, cache_fd) != 19) { } else if (fwrite("--- BEGIN HTML ---\n", 1, 19, cache_fd) != 19) {

View file

@ -14,8 +14,6 @@
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// TODO: Update files map.
#include "http_template.h" #include "http_template.h"
// Standard library includes. // Standard library includes.
@ -25,6 +23,7 @@
// Third party includes. // Third party includes.
#include <SimpleArchiver/src/data_structures/linked_list.h> #include <SimpleArchiver/src/data_structures/linked_list.h>
#include <SimpleArchiver/src/data_structures/hash_map.h>
#include <SimpleArchiver/src/helpers.h> #include <SimpleArchiver/src/helpers.h>
// Local includes. // Local includes.
@ -62,7 +61,22 @@ int c_simple_http_internal_handle_inside_delimeters(
SDArchiverHashMap *array_vars, SDArchiverHashMap *array_vars,
const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map, const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map,
SDArchiverLinkedList *string_part_list, SDArchiverLinkedList *string_part_list,
SDArchiverLinkedList **files_list_out); SDArchiverHashMap **files_set_out);
void c_simple_http_internal_set_out_insert(SDArchiverHashMap **set,
const char *str) {
if (set
&& *set
&& simple_archiver_hash_map_get(*set, str, strlen(str) + 1) == NULL) {
simple_archiver_hash_map_insert(
*set,
(void*)1,
strdup(str),
strlen(str) + 1,
simple_archiver_helper_datastructure_cleanup_nop,
NULL);
}
}
void c_simple_http_internal_cleanup_ArrayVar( void c_simple_http_internal_cleanup_ArrayVar(
C_SIMPLE_HTTP_ArrayVar **array_var) { C_SIMPLE_HTTP_ArrayVar **array_var) {
@ -169,7 +183,7 @@ int c_simple_http_internal_parse_if_expression(
char **left_side_out, char **left_side_out,
char **right_side_out, char **right_side_out,
uint_fast8_t *is_equality_out, uint_fast8_t *is_equality_out,
SDArchiverLinkedList **files_list_out) { SDArchiverHashMap **files_set_out) {
if (!left_side_out || !right_side_out || !is_equality_out) { if (!left_side_out || !right_side_out || !is_equality_out) {
fprintf(stderr, "ERROR Internal error! %s\n", var); fprintf(stderr, "ERROR Internal error! %s\n", var);
return 1; return 1;
@ -288,11 +302,7 @@ int c_simple_http_internal_parse_if_expression(
} }
c_simple_http_trim_end_whitespace(*left_side_out); c_simple_http_trim_end_whitespace(*left_side_out);
left_side_size = strlen(*left_side_out); left_side_size = strlen(*left_side_out);
if (files_list_out) { c_simple_http_internal_set_out_insert(files_set_out, config_value->value);
simple_archiver_list_add(*files_list_out,
strdup(config_value->value),
NULL);
}
} else { } else {
*left_side_out = strdup(config_value->value); *left_side_out = strdup(config_value->value);
c_simple_http_trim_end_whitespace(*left_side_out); c_simple_http_trim_end_whitespace(*left_side_out);
@ -346,7 +356,8 @@ int c_simple_http_internal_populate_array_vars(
const C_SIMPLE_HTTP_HashMapWrapper *wrapped_hash_map, const C_SIMPLE_HTTP_HashMapWrapper *wrapped_hash_map,
const char *var, const char *var,
SDArchiverHashMap *array_vars, SDArchiverHashMap *array_vars,
SDArchiverLinkedList *array_vars_keys) { SDArchiverLinkedList *array_vars_keys,
SDArchiverHashMap **files_set_out) {
C_SIMPLE_HTTP_ConfigValue *config_value = C_SIMPLE_HTTP_ConfigValue *config_value =
simple_archiver_hash_map_get(wrapped_hash_map->hash_map, simple_archiver_hash_map_get(wrapped_hash_map->hash_map,
*for_each_var_name, *for_each_var_name,
@ -378,6 +389,7 @@ int c_simple_http_internal_populate_array_vars(
c_simple_http_internal_cleanup_ArrayVar(&array_var); c_simple_http_internal_cleanup_ArrayVar(&array_var);
return 1; return 1;
} }
c_simple_http_internal_set_out_insert(files_set_out, config_value->value);
} else { } else {
array_var->value = strdup(config_value->value); array_var->value = strdup(config_value->value);
} }
@ -400,6 +412,8 @@ int c_simple_http_internal_populate_array_vars(
c_simple_http_internal_cleanup_ArrayVar(&array_var); c_simple_http_internal_cleanup_ArrayVar(&array_var);
return 1; return 1;
} }
c_simple_http_internal_set_out_insert(files_set_out,
config_value->value);
} else { } else {
current_array_var->value = strdup(config_value->value); current_array_var->value = strdup(config_value->value);
} }
@ -438,7 +452,7 @@ int c_simple_http_internal_parse_iterate(
SDArchiverHashMap *array_vars, SDArchiverHashMap *array_vars,
SDArchiverLinkedList *string_part_list, SDArchiverLinkedList *string_part_list,
const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map, const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map,
SDArchiverLinkedList **files_list_out) { SDArchiverHashMap **files_set_out) {
C_SIMPLE_HTTP_String_Part string_part; C_SIMPLE_HTTP_String_Part string_part;
if (((*state) & 1) == 0) { if (((*state) & 1) == 0) {
// Using 0x7B instead of left curly-brace due to bug in vim navigation. // Using 0x7B instead of left curly-brace due to bug in vim navigation.
@ -511,7 +525,7 @@ int c_simple_http_internal_parse_iterate(
array_vars, array_vars,
wrapped_hash_map, wrapped_hash_map,
string_part_list, string_part_list,
files_list_out) != 0) { files_set_out) != 0) {
return 1; return 1;
} }
} }
@ -561,7 +575,7 @@ int c_simple_http_internal_handle_inside_delimeters(
SDArchiverHashMap *array_vars, SDArchiverHashMap *array_vars,
const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map, const C_SIMPLE_HTTP_ParsedConfig *wrapped_hash_map,
SDArchiverLinkedList *string_part_list, SDArchiverLinkedList *string_part_list,
SDArchiverLinkedList **files_list_out) { SDArchiverHashMap **files_set_out) {
C_SIMPLE_HTTP_String_Part string_part; C_SIMPLE_HTTP_String_Part string_part;
if (var_size == 0) { if (var_size == 0) {
fprintf(stderr, "ERROR No characters within delimeters!\n"); fprintf(stderr, "ERROR No characters within delimeters!\n");
@ -588,7 +602,7 @@ int c_simple_http_internal_handle_inside_delimeters(
&left_side, &left_side,
&right_side, &right_side,
&is_equality, &is_equality,
files_list_out)) { files_set_out)) {
return 1; return 1;
} else if (!left_side || !right_side) { } else if (!left_side || !right_side) {
fprintf(stderr, "ERROR Internal error! %s\n", var); fprintf(stderr, "ERROR Internal error! %s\n", var);
@ -662,7 +676,7 @@ int c_simple_http_internal_handle_inside_delimeters(
&left_side, &left_side,
&right_side, &right_side,
&is_equality, &is_equality,
files_list_out)) { files_set_out)) {
return 1; return 1;
} else if (!left_side || !right_side) { } else if (!left_side || !right_side) {
fprintf(stderr, "ERROR Internal error! %s\n", var); fprintf(stderr, "ERROR Internal error! %s\n", var);
@ -824,11 +838,8 @@ int c_simple_http_internal_handle_inside_delimeters(
fprintf(stderr, "ERROR Failed to get value from FILE! %s\n", var); fprintf(stderr, "ERROR Failed to get value from FILE! %s\n", var);
return 1; return 1;
} }
if (files_list_out) { c_simple_http_internal_set_out_insert(files_set_out,
simple_archiver_list_add(*files_list_out, config_value->value);
strdup(config_value->value),
NULL);
}
} else { } else {
value_contents = strdup(config_value->value); value_contents = strdup(config_value->value);
value_contents_size = strlen(value_contents); value_contents_size = strlen(value_contents);
@ -904,7 +915,8 @@ int c_simple_http_internal_handle_inside_delimeters(
wrapped_hash_map, wrapped_hash_map,
var, var,
array_vars, array_vars,
for_state->array_vars_keys) != 0) { for_state->array_vars_keys,
files_set_out) != 0) {
if (for_each_var_name) { if (for_each_var_name) {
free(for_each_var_name); free(for_each_var_name);
} }
@ -940,7 +952,8 @@ int c_simple_http_internal_handle_inside_delimeters(
wrapped_hash_map, wrapped_hash_map,
var, var,
array_vars, array_vars,
for_state->array_vars_keys) != 0) { for_state->array_vars_keys,
files_set_out) != 0) {
if (for_each_var_name) { if (for_each_var_name) {
free(for_each_var_name); free(for_each_var_name);
} }
@ -1017,7 +1030,7 @@ int c_simple_http_internal_handle_inside_delimeters(
array_vars, array_vars,
string_part_list, string_part_list,
wrapped_hash_map, wrapped_hash_map,
files_list_out) != 0) { files_set_out) != 0) {
return 1; return 1;
} }
} }
@ -1113,10 +1126,8 @@ int c_simple_http_internal_handle_inside_delimeters(
string_part.extra = html_buf_idx + 1; string_part.extra = html_buf_idx + 1;
string_part.buf[string_part.size - 1] = 0; string_part.buf[string_part.size - 1] = 0;
if (files_list_out) { c_simple_http_internal_set_out_insert(files_set_out,
char *variable_filename = strdup(config_value->value); config_value->value);
simple_archiver_list_add(*files_list_out, variable_filename, NULL);
}
} else { } else {
// Variable data is "config_value->value". // Variable data is "config_value->value".
string_part.size = strlen(config_value->value) + 1; string_part.size = strlen(config_value->value) + 1;
@ -1145,12 +1156,12 @@ char *c_simple_http_path_to_generated(
const char *path, const char *path,
const C_SIMPLE_HTTP_HTTPTemplates *templates, const C_SIMPLE_HTTP_HTTPTemplates *templates,
size_t *output_buf_size, size_t *output_buf_size,
SDArchiverLinkedList **files_list_out) { SDArchiverHashMap **files_set_out) {
if (output_buf_size) { if (output_buf_size) {
*output_buf_size = 0; *output_buf_size = 0;
} }
if (files_list_out) { if (files_set_out) {
*files_list_out = simple_archiver_list_init(); *files_set_out = simple_archiver_hash_map_init();
} }
size_t path_len_size_t = strlen(path) + 1; size_t path_len_size_t = strlen(path) + 1;
if (path_len_size_t > 0xFFFFFFFF) { if (path_len_size_t > 0xFFFFFFFF) {
@ -1191,11 +1202,8 @@ char *c_simple_http_path_to_generated(
} }
html_buf[html_file_size] = 0; html_buf[html_file_size] = 0;
html_buf_size = (size_t)html_file_size; html_buf_size = (size_t)html_file_size;
if (files_list_out) { c_simple_http_internal_set_out_insert(files_set_out,
char *html_filename_copy = malloc(strlen(html_file_value->value) + 1); html_file_value->value);
strcpy(html_filename_copy, html_file_value->value);
simple_archiver_list_add(*files_list_out, html_filename_copy, NULL);
}
} else { } else {
C_SIMPLE_HTTP_ConfigValue *stored_html_config_value = C_SIMPLE_HTTP_ConfigValue *stored_html_config_value =
simple_archiver_hash_map_get(wrapped_hash_map->hash_map, "HTML", 5); simple_archiver_hash_map_get(wrapped_hash_map->hash_map, "HTML", 5);
@ -1255,7 +1263,7 @@ char *c_simple_http_path_to_generated(
array_vars, array_vars,
string_part_list, string_part_list,
wrapped_hash_map, wrapped_hash_map,
files_list_out) != 0) { files_set_out) != 0) {
return NULL; return NULL;
} }
} }

View file

@ -17,13 +17,16 @@
#ifndef SEODISPARATE_COM_C_SIMPLE_HTTP_HTTP_TEMPLATE_H_ #ifndef SEODISPARATE_COM_C_SIMPLE_HTTP_HTTP_TEMPLATE_H_
#define SEODISPARATE_COM_C_SIMPLE_HTTP_HTTP_TEMPLATE_H_ #define SEODISPARATE_COM_C_SIMPLE_HTTP_HTTP_TEMPLATE_H_
#include "http.h"
// Standard library includes. // Standard library includes.
#include <stddef.h> #include <stddef.h>
// Third-party includes. // Third-party includes.
#include <SimpleArchiver/src/data_structures/linked_list.h> #include <SimpleArchiver/src/data_structures/linked_list.h>
#include <SimpleArchiver/src/data_structures/hash_map.h>
// Local includes.
#include "http.h"
// Returns non-NULL on success, which must be free'd after use. Takes a path // Returns non-NULL on success, which must be free'd after use. Takes a path
// string and templates and returns the generated HTML. If "output_buf_size" is // string and templates and returns the generated HTML. If "output_buf_size" is
@ -35,7 +38,7 @@ char *c_simple_http_path_to_generated(
const char *path, const char *path,
const C_SIMPLE_HTTP_HTTPTemplates *templates, const C_SIMPLE_HTTP_HTTPTemplates *templates,
size_t *output_buf_size, size_t *output_buf_size,
SDArchiverLinkedList **files_list_out); SDArchiverHashMap **files_set_out);
#endif #endif

View file

@ -99,9 +99,13 @@ void test_internal_cleanup_delete_temporary_file(const char **filename) {
} }
} }
int test_internal_check_matching_string_in_list(void *value, void *ud) { int test_internal_check_matching_string_in_list(
if (value && ud) { const void *key,
if (strcmp(value, ud) == 0) { __attribute__((unused)) size_t key_size,
__attribute__((unused)) const void *value,
void *ud) {
if (key && ud) {
if (strcmp(key, ud) == 0) {
return 1; return 1;
} }
} }
@ -278,18 +282,18 @@ int main(int argc, char **argv) {
size_t output_buf_size; size_t output_buf_size;
__attribute__((cleanup(simple_archiver_list_free))) __attribute__((cleanup(simple_archiver_hash_map_free)))
SDArchiverLinkedList *filenames_list = NULL; SDArchiverHashMap *filenames_set = NULL;
__attribute__((cleanup(simple_archiver_helper_cleanup_c_string))) __attribute__((cleanup(simple_archiver_helper_cleanup_c_string)))
char *buf = c_simple_http_path_to_generated( char *buf = c_simple_http_path_to_generated(
"/", &config, &output_buf_size, &filenames_list); "/", &config, &output_buf_size, &filenames_set);
ASSERT_TRUE(buf != NULL); ASSERT_TRUE(buf != NULL);
ASSERT_TRUE(strcmp(buf, "<h1>Test</h1>") == 0); ASSERT_TRUE(strcmp(buf, "<h1>Test</h1>") == 0);
CHECK_TRUE(output_buf_size == 13); CHECK_TRUE(output_buf_size == 13);
CHECK_TRUE(filenames_list->count == 0); CHECK_TRUE(filenames_set->count == 0);
simple_archiver_helper_cleanup_c_string(&buf); simple_archiver_helper_cleanup_c_string(&buf);
simple_archiver_list_free(&filenames_list); simple_archiver_hash_map_free(&filenames_set);
__attribute__((cleanup(test_internal_cleanup_delete_temporary_file))) __attribute__((cleanup(test_internal_cleanup_delete_temporary_file)))
const char *test_http_template_filename2 = const char *test_http_template_filename2 =
@ -321,7 +325,7 @@ int main(int argc, char **argv) {
ASSERT_TRUE(config.paths != NULL); ASSERT_TRUE(config.paths != NULL);
buf = c_simple_http_path_to_generated( buf = c_simple_http_path_to_generated(
"/", &config, &output_buf_size, &filenames_list); "/", &config, &output_buf_size, &filenames_set);
ASSERT_TRUE(buf != NULL); ASSERT_TRUE(buf != NULL);
//printf("%s\n", buf); //printf("%s\n", buf);
ASSERT_TRUE( ASSERT_TRUE(
@ -330,9 +334,9 @@ int main(int argc, char **argv) {
"<h1> Some text. </h1><br><h2> More text. </h2>") "<h1> Some text. </h1><br><h2> More text. </h2>")
== 0); == 0);
CHECK_TRUE(output_buf_size == 46); CHECK_TRUE(output_buf_size == 46);
CHECK_TRUE(filenames_list->count == 0); CHECK_TRUE(filenames_set->count == 0);
simple_archiver_helper_cleanup_c_string(&buf); simple_archiver_helper_cleanup_c_string(&buf);
simple_archiver_list_free(&filenames_list); simple_archiver_hash_map_free(&filenames_set);
__attribute__((cleanup(test_internal_cleanup_delete_temporary_file))) __attribute__((cleanup(test_internal_cleanup_delete_temporary_file)))
const char *test_http_template_filename3 = const char *test_http_template_filename3 =
@ -387,7 +391,7 @@ int main(int argc, char **argv) {
ASSERT_TRUE(config.paths != NULL); ASSERT_TRUE(config.paths != NULL);
buf = c_simple_http_path_to_generated( buf = c_simple_http_path_to_generated(
"/", &config, &output_buf_size, &filenames_list); "/", &config, &output_buf_size, &filenames_set);
ASSERT_TRUE(buf != NULL); ASSERT_TRUE(buf != NULL);
//printf("%s\n", buf); //printf("%s\n", buf);
ASSERT_TRUE( ASSERT_TRUE(
@ -396,14 +400,14 @@ int main(int argc, char **argv) {
"<h1> testVar text. </h1><br><h2> testVar2 text. </h2>") "<h1> testVar text. </h1><br><h2> testVar2 text. </h2>")
== 0); == 0);
CHECK_TRUE(output_buf_size == 53); CHECK_TRUE(output_buf_size == 53);
CHECK_TRUE(filenames_list->count == 1); CHECK_TRUE(filenames_set->count == 1);
CHECK_TRUE(simple_archiver_list_get( CHECK_TRUE(simple_archiver_hash_map_iter(
filenames_list, filenames_set,
test_internal_check_matching_string_in_list, test_internal_check_matching_string_in_list,
(void*)test_http_template_html_filename) (void*)test_http_template_html_filename)
!= NULL); != 0);
simple_archiver_helper_cleanup_c_string(&buf); simple_archiver_helper_cleanup_c_string(&buf);
simple_archiver_list_free(&filenames_list); simple_archiver_hash_map_free(&filenames_set);
__attribute__((cleanup(test_internal_cleanup_delete_temporary_file))) __attribute__((cleanup(test_internal_cleanup_delete_temporary_file)))
const char *test_http_template_filename4 = const char *test_http_template_filename4 =
@ -478,7 +482,7 @@ int main(int argc, char **argv) {
ASSERT_TRUE(config.paths != NULL); ASSERT_TRUE(config.paths != NULL);
buf = c_simple_http_path_to_generated( buf = c_simple_http_path_to_generated(
"/", &config, &output_buf_size, &filenames_list); "/", &config, &output_buf_size, &filenames_set);
ASSERT_TRUE(buf != NULL); ASSERT_TRUE(buf != NULL);
//printf("%s\n", buf); //printf("%s\n", buf);
ASSERT_TRUE( ASSERT_TRUE(
@ -487,17 +491,17 @@ int main(int argc, char **argv) {
"<h1> some test text in test var file. </h1>") "<h1> some test text in test var file. </h1>")
== 0); == 0);
CHECK_TRUE(output_buf_size == 43); CHECK_TRUE(output_buf_size == 43);
CHECK_TRUE(filenames_list->count == 2); CHECK_TRUE(filenames_set->count == 2);
CHECK_TRUE(simple_archiver_list_get( CHECK_TRUE(simple_archiver_hash_map_iter(
filenames_list, filenames_set,
test_internal_check_matching_string_in_list, test_internal_check_matching_string_in_list,
(void*)test_http_template_html_filename2) (void*)test_http_template_html_filename2)
!= NULL); != 0);
CHECK_TRUE(simple_archiver_list_get( CHECK_TRUE(simple_archiver_hash_map_iter(
filenames_list, filenames_set,
test_internal_check_matching_string_in_list, test_internal_check_matching_string_in_list,
(void*)test_http_template_html_var_filename) (void*)test_http_template_html_var_filename)
!= NULL); != 0);
simple_archiver_helper_cleanup_c_string(&buf); simple_archiver_helper_cleanup_c_string(&buf);
} }