Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_html.c File Reference
#include "nilorea/n_common.h"
#include "nilorea/n_html.h"
#include "nilorea/n_list.h"
#include "nilorea/n_log.h"
#include "nilorea/n_str.h"
#include <stdio.h>
#include <string.h>
+ Include dependency graph for ex_html.c:

Go to the source code of this file.

Functions

static void expect_link_absent (LIST *links, const char *probe)
 
static void expect_link_present (LIST *links, const char *want)
 
static void expect_text (const char *label, N_STR *txt, const char *needle, int want_present)
 
static int find_link (LIST *links, const char *want)
 
static size_t list_count (LIST *l)
 
int main (int argc, char **argv)
 
void process_args (int argc, char **argv)
 
static void test_empty_and_null (void)
 
static void test_enctype (void)
 
static void test_forms (void)
 
static void test_js_urls (void)
 
static void test_links (void)
 
static void test_scripts (void)
 
static void test_sitemap (void)
 
static void test_to_text (void)
 

Variables

static int failures = 0
 

Function Documentation

◆ expect_link_absent()

static void expect_link_absent ( LIST links,
const char *  probe 
)
static
Examples
ex_html.c.

Definition at line 88 of file ex_html.c.

References failures, find_link(), LOG_ERR, and n_log.

Referenced by test_js_urls(), test_links(), and test_scripts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expect_link_present()

static void expect_link_present ( LIST links,
const char *  want 
)
static
Examples
ex_html.c.

Definition at line 79 of file ex_html.c.

References failures, find_link(), LOG_ERR, LOG_INFO, and n_log.

Referenced by test_js_urls(), test_links(), and test_scripts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expect_text()

static void expect_text ( const char *  label,
N_STR txt,
const char *  needle,
int  want_present 
)
static
Examples
ex_html.c.

Definition at line 298 of file ex_html.c.

References N_STR::data, failures, LOG_ERR, and n_log.

Referenced by test_to_text().

+ Here is the caller graph for this function:

◆ find_link()

static int find_link ( LIST links,
const char *  want 
)
static
Examples
ex_html.c.

Definition at line 70 of file ex_html.c.

References N_STR::data, and list_foreach.

Referenced by expect_link_absent(), and expect_link_present().

+ Here is the caller graph for this function:

◆ list_count()

static size_t list_count ( LIST l)
static
Examples
ex_html.c.

Definition at line 361 of file ex_html.c.

References list_foreach.

Referenced by test_js_urls(), and test_scripts().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

◆ process_args()

void process_args ( int  argc,
char **  argv 
)

Definition at line 39 of file ex_html.c.

References LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_NOTICE, LOG_NULL, and set_log_level().

+ Here is the call graph for this function:

◆ test_empty_and_null()

static void test_empty_and_null ( void  )
static
Examples
ex_html.c.

Definition at line 255 of file ex_html.c.

References failures, n_html_extract_forms(), n_html_extract_links(), n_html_forms_free(), n_html_links_free(), n_sitemap_extract_urls(), and LIST::nb_items.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_enctype()

static void test_enctype ( void  )
static
Examples
ex_html.c.

Definition at line 270 of file ex_html.c.

References N_HTML_FORM::enctype, failures, LOG_ERR, n_html_extract_forms(), n_html_forms_free(), n_log, LIST::nb_items, LIST_NODE::next, LIST_NODE::ptr, and LIST::start.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_forms()

static void test_forms ( void  )
static
Examples
ex_html.c.

Definition at line 145 of file ex_html.c.

References N_HTML_FORM::action, failures, N_HTML_FORM::fields, LOG_ERR, N_HTML_FORM::method, n_html_extract_forms(), n_html_forms_free(), n_log, N_FORM_FIELD::name, LIST::nb_items, LIST_NODE::next, LIST_NODE::ptr, N_FORM_FIELD::required, LIST::start, N_FORM_FIELD::type, and N_FORM_FIELD::value.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_js_urls()

static void test_js_urls ( void  )
static
Examples
ex_html.c.

Definition at line 371 of file ex_html.c.

References expect_link_absent(), expect_link_present(), failures, list_count(), LOG_ERR, n_html_extract_js_urls(), n_html_links_free(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_links()

static void test_links ( void  )
static
Examples
ex_html.c.

Definition at line 95 of file ex_html.c.

References expect_link_absent(), expect_link_present(), failures, LOG_ERR, n_html_extract_links(), n_html_links_free(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_scripts()

static void test_scripts ( void  )
static
Examples
ex_html.c.

Definition at line 409 of file ex_html.c.

References N_STR::data, expect_link_absent(), expect_link_present(), failures, free_nstr, list_count(), list_foreach, LOG_ERR, n_html_extract_js_urls(), n_html_extract_scripts(), n_html_links_free(), n_log, new_nstr(), nstrprintf_cat, and N_STR::written.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_sitemap()

static void test_sitemap ( void  )
static
Examples
ex_html.c.

Definition at line 223 of file ex_html.c.

References N_STR::data, failures, LOG_ERR, n_html_links_free(), n_log, n_sitemap_extract_urls(), LIST::nb_items, LIST_NODE::next, LIST_NODE::ptr, and LIST::start.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_to_text()

static void test_to_text ( void  )
static
Examples
ex_html.c.

Definition at line 306 of file ex_html.c.

References N_STR::data, expect_text(), failures, free_nstr, LOG_ERR, n_html_to_text(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 36 of file ex_html.c.