Lines Matching defs:test

101 		pr_err("error in test suite: expected output length %d too long. Format was '%s'.\n",
112 * enough and 0), and then we also test that kvasprintf would
134 #define test(expect, fmt, ...) \
143 test("", &nul);
144 test("100%", "100%%");
145 test("xxx%yyy", "xxx%cyyy", '%');
152 test("0x1234abcd ", "%#-12x", 0x1234abcd);
153 test(" 0x1234abcd", "%#12x", 0x1234abcd);
154 test("0|001| 12|+123| 1234|-123|-1234", "%d|%03d|%3d|%+d|% d|%+d|% d", 0, 1, 12, 123, 1234, -123, -1234);
155 test("0|1|1|128|255", "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1);
156 test("0|1|1|-128|-1", "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1);
157 test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627);
161 * from the below test should really be "00|0||| ". However,
163 * case. This test case simply documents the current
166 test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0);
176 test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val);
184 test("", "%s%.0s", "", "123");
185 test("ABCD|abc|123", "%s|%.3s|%.*s", "ABCD", "abcdef", 3, "123456");
186 test("1 | 2|3 | 4|5 ", "%-3s|%3s|%-*s|%*s|%*s", "1", "2", 3, "3", 3, "4", -3, "5");
187 test("1234 ", "%-10.4s", "123456");
188 test(" 1234", "%10.4s", "123456");
198 * These test cases document the current behaviour; should
202 test(" ", "%4.*s", -5, "123456");
203 test("123456", "%.s", "123456");
204 test("a||", "%.s|%.0s|%.*s", "a", "b", 0, "c");
205 test("a | | ", "%-3.s|%-3.0s|%-3.*s", "a", "b", 0, "c");
296 * We can't use test() to test %p because we don't know what output to expect
325 * No need to increase failed test counter since this is assumed
332 test(buf, fmt, p);
341 test(ZEROS "00000000", "%p", NULL);
342 test(ZEROS "00000000", "%px", NULL);
343 test("(null)", "%pE", NULL);
352 test(ONES "fffffff5", "%p", ERR_PTR(-11));
353 test(ONES "fffffff5", "%px", ERR_PTR(-11));
354 test("(efault)", "%pE", ERR_PTR(-11));
363 test(ZEROS "000000ab", "%px", PTR_INVALID);
364 test("(efault)", "%pE", PTR_INVALID);
375 /* We can't test this without access to kptr_restrict. */
398 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee",
400 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee",
409 test("2d:48:d6:fc:7a:05", "%pM", addr);
410 test("05:7a:fc:d6:48:2d", "%pMR", addr);
411 test("2d-48-d6-fc-7a-05", "%pMF", addr);
412 test("2d48d6fc7a05", "%pm", addr);
413 test("057afcd6482d", "%pmR", addr);
425 test("127.000.000.001|127.0.0.1", "%pi4|%pI4", &sa.sin_addr, &sa.sin_addr);
426 test("127.000.000.001|127.0.0.1", "%piS|%pIS", &sa, &sa);
428 test("001.002.003.004:12345|1.2.3.4:12345", "%piSp|%pISp", &sa, &sa);
449 test("00010203-0405-0607-0809-0a0b0c0d0e0f", "%pUb", uuid);
450 test("00010203-0405-0607-0809-0A0B0C0D0E0F", "%pUB", uuid);
451 test("03020100-0504-0706-0809-0a0b0c0d0e0f", "%pUl", uuid);
452 test("03020100-0504-0706-0809-0A0B0C0D0E0F", "%pUL", uuid);
473 test("foo", "%pd", &test_dentry[0]);
474 test("foo", "%pd2", &test_dentry[0]);
476 test("(null)", "%pd", NULL);
477 test("(efault)", "%pd", PTR_INVALID);
478 test("(null)", "%pD", NULL);
479 test("(efault)", "%pD", PTR_INVALID);
481 test("romeo", "%pd", &test_dentry[3]);
482 test("alfa/romeo", "%pd2", &test_dentry[3]);
483 test("bravo/alfa/romeo", "%pd3", &test_dentry[3]);
484 test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]);
485 test("/bravo/alfa", "%pd4", &test_dentry[2]);
487 test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]);
488 test(" bravo/alfa| bravo/alfa", "%12pd2|%*pd2", &test_dentry[2], 12, &test_dentry[2]);
511 test("(%pt?)", "%pt", &tm);
512 test("2018-11-26T05:35:43", "%ptR", &tm);
513 test("0118-10-26T05:35:43", "%ptRr", &tm);
514 test("05:35:43|2018-11-26", "%ptRt|%ptRd", &tm, &tm);
515 test("05:35:43|0118-10-26", "%ptRtr|%ptRdr", &tm, &tm);
516 test("05:35:43|2018-11-26", "%ptRttr|%ptRdtr", &tm, &tm);
517 test("05:35:43 tr|2018-11-26 tr", "%ptRt tr|%ptRd tr", &tm, &tm);
519 test("2019-01-04T15:32:23", "%ptT", &t);
520 test("0119-00-04T15:32:23", "%ptTr", &t);
521 test("15:32:23|2019-01-04", "%ptTt|%ptTd", &t, &t);
522 test("15:32:23|0119-00-04", "%ptTtr|%ptTdr", &t, &t);
540 test("1-20,60000-60014", "%*pbl", nbits, bits);
552 test("00000|00000", "%20pb|%*pb", bits, 20, bits);
553 test("|", "%20pbl|%*pbl", bits, 20, bits);
557 test("a28ac|a28ac", "%20pb|%*pb", bits, 20, bits);
558 test("2-3,5,7,11,13,17,19|2-3,5,7,11,13,17,19", "%20pbl|%*pbl", bits, 20, bits);
561 test("fffff|fffff", "%20pb|%*pb", bits, 20, bits);
562 test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits);
580 test("", "%pGp", &flags);
584 test("", "%pGp", &flags);
588 test("uptodate|dirty|lru|active|swapbacked", "%pGp", &flags);
593 test("read|exec|mayread|maywrite|mayexec|denywrite", "%pGv", &flags);
596 test("GFP_TRANSHUGE", "%pGg", &gfp);
599 test("GFP_ATOMIC|GFP_DMA", "%pGg", &gfp);
602 test("__GFP_ATOMIC", "%pGg", &gfp);
611 test(cmp_buffer, "%pGg", &gfp);
616 test(cmp_buffer, "%pGg", &gfp);
641 test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1]));
642 test(full_name, "%pfw", software_node_fwnode(&softnodes[2]));
643 test(full_name, "%pfwf", software_node_fwnode(&softnodes[2]));
644 test(second_name, "%pfwP", software_node_fwnode(&softnodes[1]));
645 test(third_name, "%pfwP", software_node_fwnode(&softnodes[2]));
655 test("-1234", "%pe", ERR_PTR(-1234));
662 test("(-ENOTSOCK)", "(%pe)", ERR_PTR(-ENOTSOCK));
663 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EAGAIN));
665 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EWOULDBLOCK));
666 test("[-EIO ]", "[%-8pe]", ERR_PTR(-EIO));
667 test("[ -EIO]", "[%8pe]", ERR_PTR(-EIO));
668 test("-EPROBE_DEFER", "%pe", ERR_PTR(-EPROBE_DEFER));