Lines Matching refs:test
147 #define test(expect, fmt, ...) \ macro
156 test("", &nul); in test_basic()
157 test("100%", "100%%"); in test_basic()
158 test("xxx%yyy", "xxx%cyyy", '%'); in test_basic()
165 test("0x1234abcd ", "%#-12x", 0x1234abcd); in test_number()
166 test(" 0x1234abcd", "%#12x", 0x1234abcd); in test_number()
167 …test("0|001| 12|+123| 1234|-123|-1234", "%d|%03d|%3d|%+d|% d|%+d|% d", 0, 1, 12, 123, 1234, -123, … in test_number()
169 test("0|1|1|128|255", "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1); in test_number()
170 test("0|1|1|-128|-1", "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1); in test_number()
171 test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627); in test_number()
181 test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0); in test_number()
191 test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val); in test_number()
199 test("", "%s%.0s", "", "123"); in test_string()
200 test("ABCD|abc|123", "%s|%.3s|%.*s", "ABCD", "abcdef", 3, "123456"); in test_string()
201 test("1 | 2|3 | 4|5 ", "%-3s|%3s|%-*s|%*s|%*s", "1", "2", 3, "3", 3, "4", -3, "5"); in test_string()
202 test("1234 ", "%-10.4s", "123456"); in test_string()
203 test(" 1234", "%10.4s", "123456"); in test_string()
217 test(" ", "%4.*s", -5, "123456"); in test_string()
218 test("123456", "%.s", "123456"); in test_string()
219 test("a||", "%.s|%.0s|%.*s", "a", "b", 0, "c"); in test_string()
220 test("a | | ", "%-3.s|%-3.0s|%-3.*s", "a", "b", 0, "c"); in test_string()
353 test(buf, fmt, p); in test_hashed()
362 test(ZEROS "00000000", "%p", NULL); in null_pointer()
363 test(ZEROS "00000000", "%px", NULL); in null_pointer()
364 test("(null)", "%pE", NULL); in null_pointer()
373 test(ONES "fffffff5", "%p", ERR_PTR(-11)); in error_pointer()
374 test(ONES "fffffff5", "%px", ERR_PTR(-11)); in error_pointer()
375 test("(efault)", "%pE", ERR_PTR(-11)); in error_pointer()
384 test(ZEROS "000000ab", "%px", PTR_INVALID); in invalid_pointer()
385 test("(efault)", "%pE", PTR_INVALID); in invalid_pointer()
419 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee", in hex_string()
421 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee", in hex_string()
430 test("2d:48:d6:fc:7a:05", "%pM", addr); in mac()
431 test("05:7a:fc:d6:48:2d", "%pMR", addr); in mac()
432 test("2d-48-d6-fc-7a-05", "%pMF", addr); in mac()
433 test("2d48d6fc7a05", "%pm", addr); in mac()
434 test("057afcd6482d", "%pmR", addr); in mac()
446 test("127.000.000.001|127.0.0.1", "%pi4|%pI4", &sa.sin_addr, &sa.sin_addr); in ip4()
447 test("127.000.000.001|127.0.0.1", "%piS|%pIS", &sa, &sa); in ip4()
449 test("001.002.003.004:12345|1.2.3.4:12345", "%piSp|%pISp", &sa, &sa); in ip4()
470 test("00010203-0405-0607-0809-0a0b0c0d0e0f", "%pUb", uuid); in uuid()
471 test("00010203-0405-0607-0809-0A0B0C0D0E0F", "%pUB", uuid); in uuid()
472 test("03020100-0504-0706-0809-0a0b0c0d0e0f", "%pUl", uuid); in uuid()
473 test("03020100-0504-0706-0809-0A0B0C0D0E0F", "%pUL", uuid); in uuid()
494 test("foo", "%pd", &test_dentry[0]); in dentry()
495 test("foo", "%pd2", &test_dentry[0]); in dentry()
497 test("(null)", "%pd", NULL); in dentry()
498 test("(efault)", "%pd", PTR_INVALID); in dentry()
499 test("(null)", "%pD", NULL); in dentry()
500 test("(efault)", "%pD", PTR_INVALID); in dentry()
502 test("romeo", "%pd", &test_dentry[3]); in dentry()
503 test("alfa/romeo", "%pd2", &test_dentry[3]); in dentry()
504 test("bravo/alfa/romeo", "%pd3", &test_dentry[3]); in dentry()
505 test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]); in dentry()
506 test("/bravo/alfa", "%pd4", &test_dentry[2]); in dentry()
508 test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]); in dentry()
509 test(" bravo/alfa| bravo/alfa", "%12pd2|%*pd2", &test_dentry[2], 12, &test_dentry[2]); in dentry()
532 test("(%pt?)", "%pt", &tm); in time_and_date()
533 test("2018-11-26T05:35:43", "%ptR", &tm); in time_and_date()
534 test("0118-10-26T05:35:43", "%ptRr", &tm); in time_and_date()
535 test("05:35:43|2018-11-26", "%ptRt|%ptRd", &tm, &tm); in time_and_date()
536 test("05:35:43|0118-10-26", "%ptRtr|%ptRdr", &tm, &tm); in time_and_date()
537 test("05:35:43|2018-11-26", "%ptRttr|%ptRdtr", &tm, &tm); in time_and_date()
538 test("05:35:43 tr|2018-11-26 tr", "%ptRt tr|%ptRd tr", &tm, &tm); in time_and_date()
540 test("2019-01-04T15:32:23", "%ptT", &t); in time_and_date()
541 test("0119-00-04T15:32:23", "%ptTr", &t); in time_and_date()
542 test("15:32:23|2019-01-04", "%ptTt|%ptTd", &t, &t); in time_and_date()
543 test("15:32:23|0119-00-04", "%ptTtr|%ptTdr", &t, &t); in time_and_date()
545 test("2019-01-04 15:32:23", "%ptTs", &t); in time_and_date()
546 test("0119-00-04 15:32:23", "%ptTsr", &t); in time_and_date()
547 test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t); in time_and_date()
548 test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t); in time_and_date()
566 test("1-20,60000-60014", "%*pbl", nbits, bits); in large_bitmap()
578 test("00000|00000", "%20pb|%*pb", bits, 20, bits); in bitmap()
579 test("|", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
583 test("a28ac|a28ac", "%20pb|%*pb", bits, 20, bits); in bitmap()
584 test("2-3,5,7,11,13,17,19|2-3,5,7,11,13,17,19", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
587 test("fffff|fffff", "%20pb|%*pb", bits, 20, bits); in bitmap()
588 test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
654 test(cmp_buf, "%pGp", &flags); in page_flags_test()
681 test("read|exec|mayread|maywrite|mayexec", "%pGv", &flags); in flags()
684 test("GFP_TRANSHUGE", "%pGg", &gfp); in flags()
687 test("GFP_ATOMIC|GFP_DMA", "%pGg", &gfp); in flags()
690 test("__GFP_ATOMIC", "%pGg", &gfp); in flags()
695 test(cmp_buffer, "%pGg", &gfp); in flags()
700 test(cmp_buffer, "%pGg", &gfp); in flags()
725 test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1])); in fwnode_pointer()
726 test(full_name, "%pfw", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
727 test(full_name, "%pfwf", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
728 test(second_name, "%pfwP", software_node_fwnode(&softnodes[1])); in fwnode_pointer()
729 test(third_name, "%pfwP", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
748 test(try[i].str, "%p4cc", &try[i].code); in fourcc_pointer()
754 test("-1234", "%pe", ERR_PTR(-1234)); in errptr()
761 test("(-ENOTSOCK)", "(%pe)", ERR_PTR(-ENOTSOCK)); in errptr()
762 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EAGAIN)); in errptr()
764 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EWOULDBLOCK)); in errptr()
765 test("[-EIO ]", "[%-8pe]", ERR_PTR(-EIO)); in errptr()
766 test("[ -EIO]", "[%8pe]", ERR_PTR(-EIO)); in errptr()
767 test("-EPROBE_DEFER", "%pe", ERR_PTR(-EPROBE_DEFER)); in errptr()