aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-09 03:33:14 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-09 03:33:14 +0200
commit1c8174674d522a2c55b4f143f7e0dac848e34281 (patch)
tree5cb1d9c51036fb7993bb1bd43ad99089fed77721
parent9dd0fcbeaed19c362ed2d1071d2ea967572b67f4 (diff)
downloadblogc-1c8174674d522a2c55b4f143f7e0dac848e34281.tar.gz
blogc-1c8174674d522a2c55b4f143f7e0dac848e34281.tar.bz2
blogc-1c8174674d522a2c55b4f143f7e0dac848e34281.zip
blogc: common: moved "file" to common
-rw-r--r--Makefile.am7
-rw-r--r--src/blogc/loader.c6
-rw-r--r--src/common/error.c6
-rw-r--r--src/common/error.h2
-rw-r--r--src/common/file.c (renamed from src/blogc/file.c)19
-rw-r--r--src/common/file.h (renamed from src/blogc/file.h)6
-rw-r--r--tests/blogc/check_loader.c222
7 files changed, 132 insertions, 136 deletions
diff --git a/Makefile.am b/Makefile.am
index d025b16..6cf2f6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,13 +35,13 @@ noinst_HEADERS = \
src/blogc/content-parser.h \
src/blogc/datetime-parser.h \
src/blogc/debug.h \
- src/blogc/file.h \
src/blogc/loader.h \
src/blogc/renderer.h \
src/blogc/source-parser.h \
src/blogc/template-parser.h \
src/common/config-parser.h \
src/common/error.h \
+ src/common/file.h \
src/common/utf8.h \
src/common/utils.h \
$(NULL)
@@ -77,7 +77,6 @@ check_PROGRAMS = \
libblogc_la_SOURCES = \
src/blogc/content-parser.c \
src/blogc/datetime-parser.c \
- src/blogc/file.c \
src/blogc/loader.c \
src/blogc/renderer.c \
src/blogc/source-parser.c \
@@ -96,6 +95,7 @@ libblogc_la_LIBADD = \
libblogc_common_la_SOURCES = \
src/common/config-parser.c \
src/common/error.c \
+ src/common/file.c \
src/common/utf8.c \
src/common/utils.c \
$(NULL)
@@ -291,8 +291,7 @@ tests_blogc_check_loader_CFLAGS = \
tests_blogc_check_loader_LDFLAGS = \
-no-install \
- -Wl,--wrap=blogc_file_get_contents \
- -Wl,--wrap=blogc_fprintf \
+ -Wl,--wrap=bc_file_get_contents \
$(NULL)
tests_blogc_check_loader_LDADD = \
diff --git a/src/blogc/loader.c b/src/blogc/loader.c
index 754723b..b182e0b 100644
--- a/src/blogc/loader.c
+++ b/src/blogc/loader.c
@@ -12,11 +12,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "file.h"
#include "source-parser.h"
#include "template-parser.h"
#include "loader.h"
#include "../common/error.h"
+#include "../common/file.h"
#include "../common/utils.h"
@@ -63,7 +63,7 @@ blogc_template_parse_from_file(const char *f, bc_error_t **err)
if (err == NULL || *err != NULL)
return NULL;
size_t len;
- char *s = blogc_file_get_contents(f, &len, err);
+ char *s = bc_file_get_contents(f, &len, err);
if (s == NULL)
return NULL;
bc_slist_t *rv = blogc_template_parse(s, len, err);
@@ -78,7 +78,7 @@ blogc_source_parse_from_file(const char *f, bc_error_t **err)
if (err == NULL || *err != NULL)
return NULL;
size_t len;
- char *s = blogc_file_get_contents(f, &len, err);
+ char *s = bc_file_get_contents(f, &len, err);
if (s == NULL)
return NULL;
bc_trie_t *rv = blogc_source_parse(s, len, err);
diff --git a/src/common/error.c b/src/common/error.c
index 1ea6e0d..a6a5f24 100644
--- a/src/common/error.c
+++ b/src/common/error.c
@@ -112,6 +112,9 @@ bc_error_print(bc_error_t *err)
case BC_ERROR_CONFIG_PARSER:
fprintf(stderr, "error: config-parser: %s\n", err->msg);
break;
+ case BC_ERROR_FILE:
+ fprintf(stderr, "error: file: %s\n", err->msg);
+ break;
case BLOGC_ERROR_SOURCE_PARSER:
fprintf(stderr, "error: source: %s\n", err->msg);
break;
@@ -121,9 +124,6 @@ bc_error_print(bc_error_t *err)
case BLOGC_ERROR_LOADER:
fprintf(stderr, "error: loader: %s\n", err->msg);
break;
- case BLOGC_ERROR_FILE:
- fprintf(stderr, "error: file: %s\n", err->msg);
- break;
case BLOGC_WARNING_DATETIME_PARSER:
fprintf(stderr, "warning: datetime: %s\n", err->msg);
break;
diff --git a/src/common/error.h b/src/common/error.h
index 2569538..d65a3e7 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -16,12 +16,12 @@ typedef enum {
// errors for src/common
BC_ERROR_CONFIG_PARSER = 1,
+ BC_ERROR_FILE,
// errors for src/blogc
BLOGC_ERROR_SOURCE_PARSER = 100,
BLOGC_ERROR_TEMPLATE_PARSER,
BLOGC_ERROR_LOADER,
- BLOGC_ERROR_FILE,
BLOGC_WARNING_DATETIME_PARSER,
} bc_error_type_t;
diff --git a/src/blogc/file.c b/src/common/file.c
index 518c665..70a5631 100644
--- a/src/blogc/file.c
+++ b/src/common/file.c
@@ -13,16 +13,13 @@
#include <stdio.h>
#include <string.h>
#include "file.h"
-#include "../common/error.h"
-#include "../common/utf8.h"
-#include "../common/utils.h"
-
-// this would belong to loader.c, but we need it in a separated file to be
-// able to mock it when unit testing the loader functions.
+#include "error.h"
+#include "utf8.h"
+#include "utils.h"
char*
-blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
+bc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
{
if (path == NULL || err == NULL || *err != NULL)
return NULL;
@@ -32,17 +29,17 @@ blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
if (fp == NULL) {
int tmp_errno = errno;
- *err = bc_error_new_printf(BLOGC_ERROR_FILE,
+ *err = bc_error_new_printf(BC_ERROR_FILE,
"Failed to open file (%s): %s", path, strerror(tmp_errno));
return NULL;
}
bc_string_t *str = bc_string_new();
- char buffer[BLOGC_FILE_CHUNK_SIZE];
+ char buffer[BC_FILE_CHUNK_SIZE];
char *tmp;
while (!feof(fp)) {
- size_t read_len = fread(buffer, sizeof(char), BLOGC_FILE_CHUNK_SIZE, fp);
+ size_t read_len = fread(buffer, sizeof(char), BC_FILE_CHUNK_SIZE, fp);
tmp = buffer;
@@ -60,7 +57,7 @@ blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
fclose(fp);
if (!bc_utf8_validate_str(str)) {
- *err = bc_error_new_printf(BLOGC_ERROR_FILE,
+ *err = bc_error_new_printf(BC_ERROR_FILE,
"File content is not valid UTF-8: %s", path);
bc_string_free(str, true);
return NULL;
diff --git a/src/blogc/file.h b/src/common/file.h
index 6a0e094..e095de7 100644
--- a/src/blogc/file.h
+++ b/src/common/file.h
@@ -10,10 +10,10 @@
#define _FILE_H
#include <stddef.h>
-#include "../common/error.h"
+#include "error.h"
-#define BLOGC_FILE_CHUNK_SIZE 1024
+#define BC_FILE_CHUNK_SIZE 1024
-char* blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err);
+char* bc_file_get_contents(const char *path, size_t *len, bc_error_t **err);
#endif /* _FILE_H */
diff --git a/tests/blogc/check_loader.c b/tests/blogc/check_loader.c
index 5257e1d..52521e2 100644
--- a/tests/blogc/check_loader.c
+++ b/tests/blogc/check_loader.c
@@ -50,7 +50,7 @@ test_get_filename(void **state)
char*
-__wrap_blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
+__wrap_bc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
{
assert_null(*err);
const char *_path = mock_type(const char*);
@@ -68,8 +68,8 @@ static void
test_template_parse_from_file(void **state)
{
bc_error_t *err = NULL;
- will_return(__wrap_blogc_file_get_contents, "bola");
- will_return(__wrap_blogc_file_get_contents, bc_strdup("{{ BOLA }}\n"));
+ will_return(__wrap_bc_file_get_contents, "bola");
+ will_return(__wrap_bc_file_get_contents, bc_strdup("{{ BOLA }}\n"));
bc_slist_t *l = blogc_template_parse_from_file("bola", &err);
assert_null(err);
assert_non_null(l);
@@ -82,8 +82,8 @@ static void
test_template_parse_from_file_null(void **state)
{
bc_error_t *err = NULL;
- will_return(__wrap_blogc_file_get_contents, "bola");
- will_return(__wrap_blogc_file_get_contents, NULL);
+ will_return(__wrap_bc_file_get_contents, "bola");
+ will_return(__wrap_bc_file_get_contents, NULL);
bc_slist_t *l = blogc_template_parse_from_file("bola", &err);
assert_null(err);
assert_null(l);
@@ -94,8 +94,8 @@ static void
test_source_parse_from_file(void **state)
{
bc_error_t *err = NULL;
- will_return(__wrap_blogc_file_get_contents, "bola.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"--------\n"
"bola"));
@@ -117,8 +117,8 @@ static void
test_source_parse_from_file_null(void **state)
{
bc_error_t *err = NULL;
- will_return(__wrap_blogc_file_get_contents, "bola.txt");
- will_return(__wrap_blogc_file_get_contents, NULL);
+ will_return(__wrap_bc_file_get_contents, "bola.txt");
+ will_return(__wrap_bc_file_get_contents, NULL);
bc_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
assert_null(err);
assert_null(t);
@@ -128,20 +128,20 @@ test_source_parse_from_file_null(void **state)
static void
test_source_parse_from_files(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
@@ -170,22 +170,22 @@ test_source_parse_from_files(void **state)
static void
test_source_parse_from_files_filter_by_tag(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"TAGS: bola, chunda\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
@@ -216,44 +216,44 @@ test_source_parse_from_files_filter_by_tag(void **state)
static void
test_source_parse_from_files_filter_by_page(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
@@ -294,44 +294,44 @@ test_source_parse_from_files_filter_by_page(void **state)
static void
test_source_parse_from_files_filter_by_page2(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
@@ -373,44 +373,44 @@ test_source_parse_from_files_filter_by_page2(void **state)
static void
test_source_parse_from_files_filter_by_page3(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
@@ -451,48 +451,48 @@ test_source_parse_from_files_filter_by_page3(void **state)
static void
test_source_parse_from_files_filter_by_page_and_tag(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"TAGS: chunda bola\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"TAGS: bola\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"TAGS: yay chunda\n"
@@ -536,44 +536,44 @@ test_source_parse_from_files_filter_by_page_and_tag(void **state)
static void
test_source_parse_from_files_filter_by_page_invalid(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
@@ -614,44 +614,44 @@ test_source_parse_from_files_filter_by_page_invalid(void **state)
static void
test_source_parse_from_files_filter_by_page_invalid2(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola4.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola5.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola6.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola7.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
@@ -679,19 +679,19 @@ test_source_parse_from_files_filter_by_page_invalid2(void **state)
static void
test_source_parse_from_files_without_all_dates(void **state)
{
- will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola1.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 123\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola2.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
- will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, bc_strdup(
+ will_return(__wrap_bc_file_get_contents, "bola3.txt");
+ will_return(__wrap_bc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"