GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — html_parser/tests/html_parser_attribute_reader_test.c at master · timeout/html_parser

Expand file tree

/

html_parser_attribute_reader_test.c

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
70 lines (51 loc) · 1.59 KB
/

html_parser_attribute_reader_test.c

Copy path

File metadata and controls

70 lines (51 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#include <string.h>
#include "html_parser_assert.h"
#include "html_parser_mem.h"
#include "html_parser_fmt.h"
#include "html_parser_text.h"
#include "html_parser_attribute_rep.h"
#include "html_parser_attribute_list.h"
#include "html_parser_attribute_reader.h"
#include "html_parser_tester.h"
#define T Test_T
#define ATTR_LIST_SIZE 3
/* test data */
/* test functions */
static int Test_attribute_list_reader(T t, void *, const void *);
int main(int argc, const char *argv[])
{
Test_T suite;
char *attrs[ATTR_LIST_SIZE] = {
"body id=\"genre\"",
"title=\"Eternally Yours\"",
"rel=\"stylesheet\" type=\"text/css\" href=\"https://d11xdyzr0div58.cloudfront.net/static/archweb.78c17bb7e94a.css\" media=\"screen, projection\" title=\"Arch Linux Packages\""
};
Fmt_fprint(stderr, "==> Starting %s <==\n", __FILE__);
suite = Test_init();
Test_add(suite, Test_attribute_list_reader, NULL, (const void *) attrs);
Test_all_run(suite);
Test_print_results(suite);
Test_free(&suite);
return 0;
}
static int Test_attribute_list_reader(T t, void *s, const void *chk)
{
char **attrs = (char **) chk;
Text_T fout = Text_box("", 0);
Fmt_register('T', Text_fmt);
for(int i = 0; i < ATTR_LIST_SIZE; i++) {
char *lr;
Attr_list_T head = Attr_list_list();
Text_T tmp = Text_put(attrs[i]);
head = Attribute_reader(&tmp);
lr = (char *) Attr_list_print(head);
fout = Text_cat(fout, Text_put(lr));
fout = Text_cat(fout, Text_put("\n"));
FREE(lr);
Attr_list_free(&head);
}
fout = Text_sub(fout, 1, -2);
TEST_FUNC_NAME(t);
TEST_FUNC_OUT(t, Fmt_string("%T", &fout));
return TEST_SUCCESS;
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.