diff options
author | phil <phil@FreeBSD.org> | 2016-05-29 01:43:28 +0000 |
---|---|---|
committer | phil <phil@FreeBSD.org> | 2016-05-29 01:43:28 +0000 |
commit | ecdefc65a1b28ecf9a3e9ea527ab67cd3baac263 (patch) | |
tree | 18b8187920dea66da9b6b33c82e37383e88a424a /contrib/libxo/tests | |
parent | f09d81c417d3b6d0c0394b118457f4bbfc6cebc2 (diff) | |
download | FreeBSD-src-ecdefc65a1b28ecf9a3e9ea527ab67cd3baac263.zip FreeBSD-src-ecdefc65a1b28ecf9a3e9ea527ab67cd3baac263.tar.gz |
Submitted by: phil
Reviewed by: sjg (mentor)
Approved by: sjg
Diffstat (limited to 'contrib/libxo/tests')
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.E.out | 12 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.H.out | 2 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.HIPx.out | 34 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.HP.out | 34 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.J.out | 2 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.JP.out | 12 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.T.out | 4 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.X.out | 2 | ||||
-rw-r--r-- | contrib/libxo/tests/core/saved/test_03.XP.out | 8 | ||||
-rw-r--r-- | contrib/libxo/tests/core/test_03.c | 59 |
10 files changed, 160 insertions, 9 deletions
diff --git a/contrib/libxo/tests/core/saved/test_03.E.out b/contrib/libxo/tests/core/saved/test_03.E.out index 3965783..c68081f 100644 --- a/contrib/libxo/tests/core/saved/test_03.E.out +++ b/contrib/libxo/tests/core/saved/test_03.E.out @@ -1,6 +1,18 @@ op create: [] [] op open_container: [employees] [] op open_list: [employee] [] +op close_list: [employee] [] +op string: [extra] [] +op open_list: [memory] [] +op open_instance: [memory] [] +op string: [type] [name] +op content: [in-use] [12345] +op content: [memory-use] [54321] +op string: [high-use] [-] +op content: [requests] [32145] +op close_instance: [memory] [] +op close_list: [memory] [] +op open_list: [employee] [] op open_instance: [employee] [] op string: [first-name] [Terry] op string: [last-name] [Jones] diff --git a/contrib/libxo/tests/core/saved/test_03.H.out b/contrib/libxo/tests/core/saved/test_03.H.out index 6b9ccc4..ff61897 100644 --- a/contrib/libxo/tests/core/saved/test_03.H.out +++ b/contrib/libxo/tests/core/saved/test_03.H.out @@ -1 +1 @@ -<div class="line"><div class="data" data-tag="first-name">Terry</div><div class="text"> </div><div class="data" data-tag="last-name">Jones</div><div class="text"> works in dept #</div><div class="data" data-tag="department">660</div></div><div class="line"><div class="data" data-tag="first-name">Leslie</div><div class="text"> </div><div class="data" data-tag="last-name">Patterson</div><div class="text"> works in dept #</div><div class="data" data-tag="department">341</div></div><div class="line"><div class="data" data-tag="first-name">Ashley</div><div class="text"> </div><div class="data" data-tag="last-name">Smith</div><div class="text"> works in dept #</div><div class="data" data-tag="department">1440</div></div>
\ No newline at end of file +<div class="line"><div class="text">[</div><div class="data" data-tag="extra"></div><div class="text">]</div></div><div class="line"><div class="title"> Type</div><div class="text"> </div><div class="title">InUse</div><div class="text"> </div><div class="title">MemUse</div><div class="text"> </div><div class="title">HighUse</div><div class="text"> </div><div class="title">Requests</div><div class="text"> </div><div class="title">Size(s)</div></div><div class="line"><div class="data" data-tag="type"> name</div><div class="text"> </div><div class="data" data-tag="in-use">12345</div><div class="text"> </div><div class="data" data-tag="memory-use">54321</div><div class="units">K</div><div class="text"> </div><div class="data" data-tag="high-use"> -</div><div class="text"> </div><div class="data" data-tag="requests"> 32145</div><div class="text"> </div></div><div class="line"><div class="data" data-tag="first-name">Terry</div><div class="text"> </div><div class="data" data-tag="last-name">Jones</div><div class="text"> works in dept #</div><div class="data" data-tag="department">660</div></div><div class="line"><div class="data" data-tag="first-name">Leslie</div><div class="text"> </div><div class="data" data-tag="last-name">Patterson</div><div class="text"> works in dept #</div><div class="data" data-tag="department">341</div></div><div class="line"><div class="data" data-tag="first-name">Ashley</div><div class="text"> </div><div class="data" data-tag="last-name">Smith</div><div class="text"> works in dept #</div><div class="data" data-tag="department">1440</div></div><div class="line"><div class="text">done</div></div>
\ No newline at end of file diff --git a/contrib/libxo/tests/core/saved/test_03.HIPx.out b/contrib/libxo/tests/core/saved/test_03.HIPx.out index bfae221..aaf867b 100644 --- a/contrib/libxo/tests/core/saved/test_03.HIPx.out +++ b/contrib/libxo/tests/core/saved/test_03.HIPx.out @@ -1,4 +1,35 @@ <div class="line"> + <div class="text">[</div> + <div class="data" data-tag="extra" data-xpath="/employees/extra"></div> + <div class="text">]</div> +</div> +<div class="line"> + <div class="title"> Type</div> + <div class="text"> </div> + <div class="title">InUse</div> + <div class="text"> </div> + <div class="title">MemUse</div> + <div class="text"> </div> + <div class="title">HighUse</div> + <div class="text"> </div> + <div class="title">Requests</div> + <div class="text"> </div> + <div class="title">Size(s)</div> +</div> +<div class="line"> + <div class="data" data-tag="type" data-xpath="/employees/memory/type"> name</div> + <div class="text"> </div> + <div class="data" data-tag="in-use" data-xpath="/employees/memory[type = 'name']/in-use">12345</div> + <div class="text"> </div> + <div class="data" data-tag="memory-use" data-xpath="/employees/memory[type = 'name']/memory-use">54321</div> + <div class="units">K</div> + <div class="text"> </div> + <div class="data" data-tag="high-use" data-xpath="/employees/memory[type = 'name']/high-use"> -</div> + <div class="text"> </div> + <div class="data" data-tag="requests" data-xpath="/employees/memory[type = 'name']/requests"> 32145</div> + <div class="text"> </div> +</div> +<div class="line"> <div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Terry</div> <div class="text"> </div> <div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Jones</div> @@ -19,3 +50,6 @@ <div class="text"> works in dept #</div> <div class="data" data-tag="department" data-xpath="/employees/employee/department">1440</div> </div> +<div class="line"> + <div class="text">done</div> +</div> diff --git a/contrib/libxo/tests/core/saved/test_03.HP.out b/contrib/libxo/tests/core/saved/test_03.HP.out index f8b072a..2e476fb 100644 --- a/contrib/libxo/tests/core/saved/test_03.HP.out +++ b/contrib/libxo/tests/core/saved/test_03.HP.out @@ -1,4 +1,35 @@ <div class="line"> + <div class="text">[</div> + <div class="data" data-tag="extra"></div> + <div class="text">]</div> +</div> +<div class="line"> + <div class="title"> Type</div> + <div class="text"> </div> + <div class="title">InUse</div> + <div class="text"> </div> + <div class="title">MemUse</div> + <div class="text"> </div> + <div class="title">HighUse</div> + <div class="text"> </div> + <div class="title">Requests</div> + <div class="text"> </div> + <div class="title">Size(s)</div> +</div> +<div class="line"> + <div class="data" data-tag="type"> name</div> + <div class="text"> </div> + <div class="data" data-tag="in-use">12345</div> + <div class="text"> </div> + <div class="data" data-tag="memory-use">54321</div> + <div class="units">K</div> + <div class="text"> </div> + <div class="data" data-tag="high-use"> -</div> + <div class="text"> </div> + <div class="data" data-tag="requests"> 32145</div> + <div class="text"> </div> +</div> +<div class="line"> <div class="data" data-tag="first-name">Terry</div> <div class="text"> </div> <div class="data" data-tag="last-name">Jones</div> @@ -19,3 +50,6 @@ <div class="text"> works in dept #</div> <div class="data" data-tag="department">1440</div> </div> +<div class="line"> + <div class="text">done</div> +</div> diff --git a/contrib/libxo/tests/core/saved/test_03.J.out b/contrib/libxo/tests/core/saved/test_03.J.out index 4ba1fb1..00a5301 100644 --- a/contrib/libxo/tests/core/saved/test_03.J.out +++ b/contrib/libxo/tests/core/saved/test_03.J.out @@ -1,2 +1,2 @@ -{"employees": {"employee": [{"first-name":"Terry","last-name":"Jones","department":660}, {"first-name":"Leslie","last-name":"Patterson","department":341}, {"first-name":"Ashley","last-name":"Smith","department":1440}]} +{"employees": {"employee": [],"extra":"", "memory": [{"type":"name","in-use":12345,"memory-use":54321,"high-use":"-","requests":32145}], "employee": [{"first-name":"Terry","last-name":"Jones","department":660}, {"first-name":"Leslie","last-name":"Patterson","department":341}, {"first-name":"Ashley","last-name":"Smith","department":1440}]} } diff --git a/contrib/libxo/tests/core/saved/test_03.JP.out b/contrib/libxo/tests/core/saved/test_03.JP.out index ff2d5b0..a62f47e 100644 --- a/contrib/libxo/tests/core/saved/test_03.JP.out +++ b/contrib/libxo/tests/core/saved/test_03.JP.out @@ -1,6 +1,18 @@ { "employees": { "employee": [ + ], + "extra": "", + "memory": [ + { + "type": "name", + "in-use": 12345, + "memory-use": 54321, + "high-use": "-", + "requests": 32145 + } + ], + "employee": [ { "first-name": "Terry", "last-name": "Jones", diff --git a/contrib/libxo/tests/core/saved/test_03.T.out b/contrib/libxo/tests/core/saved/test_03.T.out index da60fb7..90486fb 100644 --- a/contrib/libxo/tests/core/saved/test_03.T.out +++ b/contrib/libxo/tests/core/saved/test_03.T.out @@ -1,3 +1,7 @@ +[] + Type InUse MemUse HighUse Requests Size(s) + name 12345 54321K - 32145 Terry Jones works in dept #660 Leslie Patterson works in dept #341 Ashley Smith works in dept #1440 +done diff --git a/contrib/libxo/tests/core/saved/test_03.X.out b/contrib/libxo/tests/core/saved/test_03.X.out index a626fb6..279e359 100644 --- a/contrib/libxo/tests/core/saved/test_03.X.out +++ b/contrib/libxo/tests/core/saved/test_03.X.out @@ -1 +1 @@ -<employees><employee><first-name>Terry</first-name><last-name>Jones</last-name><department>660</department></employee><employee><first-name>Leslie</first-name><last-name>Patterson</last-name><department>341</department></employee><employee><first-name>Ashley</first-name><last-name>Smith</last-name><department>1440</department></employee></employees>
\ No newline at end of file +<employees><extra></extra><memory><type>name</type><in-use>12345</in-use><memory-use>54321</memory-use><high-use>-</high-use><requests>32145</requests></memory><employee><first-name>Terry</first-name><last-name>Jones</last-name><department>660</department></employee><employee><first-name>Leslie</first-name><last-name>Patterson</last-name><department>341</department></employee><employee><first-name>Ashley</first-name><last-name>Smith</last-name><department>1440</department></employee></employees>
\ No newline at end of file diff --git a/contrib/libxo/tests/core/saved/test_03.XP.out b/contrib/libxo/tests/core/saved/test_03.XP.out index b6e7641..751bbfc 100644 --- a/contrib/libxo/tests/core/saved/test_03.XP.out +++ b/contrib/libxo/tests/core/saved/test_03.XP.out @@ -1,4 +1,12 @@ <employees> + <extra></extra> + <memory> + <type>name</type> + <in-use>12345</in-use> + <memory-use>54321</memory-use> + <high-use>-</high-use> + <requests>32145</requests> + </memory> <employee> <first-name>Terry</first-name> <last-name>Jones</last-name> diff --git a/contrib/libxo/tests/core/test_03.c b/contrib/libxo/tests/core/test_03.c index 0ab9699..af65ddd 100644 --- a/contrib/libxo/tests/core/test_03.c +++ b/contrib/libxo/tests/core/test_03.c @@ -25,6 +25,9 @@ int info_count = (sizeof(info) / sizeof(info[0])); int main (int argc, char **argv) { + unsigned opt_count = 1; + unsigned opt_extra = 0; + struct employee { const char *e_first; const char *e_last; @@ -34,24 +37,68 @@ main (int argc, char **argv) { "Leslie", "Patterson", 341 }, { "Ashley", "Smith", 1440 }, { NULL, NULL } - }, *ep = employees; + }, *ep; argc = xo_parse_args(argc, argv); if (argc < 0) return 1; + for (argc = 1; argv[argc]; argc++) { + if (strcmp(argv[argc], "count") == 0) { + if (argv[argc + 1]) + opt_count = atoi(argv[++argc]); + } else if (strcmp(argv[argc], "extra") == 0) { + if (argv[argc + 1]) + opt_extra = atoi(argv[++argc]); + } + } + xo_set_info(NULL, info, info_count); xo_open_container("employees"); xo_open_list("employee"); - for ( ; ep->e_first; ep++) { - xo_open_instance("employee"); - xo_emit("{:first-name} {:last-name} works in dept #{:department/%u}\n", - ep->e_first, ep->e_last, ep->e_dept); - xo_close_instance("employee"); + xo_emit("[{:extra/%*s}]\n", opt_extra, ""); + + xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n", + "Type", "InUse", "MemUse", "HighUse", "Requests"); + xo_open_list("memory"); + xo_open_instance("memory"); + +#define PRIu64 "llu" +#define TO_ULL(_x) ((unsigned long long) _x) + xo_emit("{k:type/%13s} {:in-use/%5" PRIu64 "} " + "{:memory-use/%5" PRIu64 "}{U:K} {:high-use/%7s} " + "{:requests/%8" PRIu64 "} ", + "name", TO_ULL(12345), TO_ULL(54321), "-", TO_ULL(32145)); + + int first = 1, i; +#if 0 + xo_open_list("size"); + for (i = 0; i < 32; i++) { + if (!first) + xo_emit(","); + xo_emit("{l:size/%d}", 1 << (i + 4)); + first = 0; + } + xo_close_list("size"); +#endif + xo_close_instance("memory"); + xo_emit("\n"); + xo_close_list("memory"); + + while (opt_count-- != 0) { + for (ep = employees; ep->e_first; ep++) { + xo_open_instance("employee"); + xo_emit("{:first-name} {:last-name} works in " + "dept #{:department/%u}\n", + ep->e_first, ep->e_last, ep->e_dept); + xo_close_instance("employee"); + } } + xo_emit("done\n"); + xo_close_list("employee"); xo_close_container("employees"); |