Lines Matching refs:test
136 #define test(expect, fmt, ...) \ macro
145 test("", &nul); in test_basic()
146 test("100%", "100%%"); in test_basic()
147 test("xxx%yyy", "xxx%cyyy", '%'); in test_basic()
154 test("0x1234abcd ", "%#-12x", 0x1234abcd); in test_number()
155 test(" 0x1234abcd", "%#12x", 0x1234abcd); in test_number()
156 …test("0|001| 12|+123| 1234|-123|-1234", "%d|%03d|%3d|%+d|% d|%+d|% d", 0, 1, 12, 123, 1234, -123, … in test_number()
157 test("0|1|1|128|255", "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1); in test_number()
158 test("0|1|1|-128|-1", "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1); in test_number()
159 test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627); in test_number()
168 test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0); in test_number()
178 test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val); in test_number()
186 test("", "%s%.0s", "", "123"); in test_string()
187 test("ABCD|abc|123", "%s|%.3s|%.*s", "ABCD", "abcdef", 3, "123456"); in test_string()
188 test("1 | 2|3 | 4|5 ", "%-3s|%3s|%-*s|%*s|%*s", "1", "2", 3, "3", 3, "4", -3, "5"); in test_string()
189 test("1234 ", "%-10.4s", "123456"); in test_string()
190 test(" 1234", "%10.4s", "123456"); in test_string()
204 test(" ", "%4.*s", -5, "123456"); in test_string()
205 test("123456", "%.s", "123456"); in test_string()
206 test("a||", "%.s|%.0s|%.*s", "a", "b", 0, "c"); in test_string()
207 test("a | | ", "%-3.s|%-3.0s|%-3.*s", "a", "b", 0, "c"); in test_string()
340 test(buf, fmt, p); in test_hashed()
349 test(ZEROS "00000000", "%p", NULL); in null_pointer()
350 test(ZEROS "00000000", "%px", NULL); in null_pointer()
351 test("(null)", "%pE", NULL); in null_pointer()
360 test(ONES "fffffff5", "%p", ERR_PTR(-11)); in error_pointer()
361 test(ONES "fffffff5", "%px", ERR_PTR(-11)); in error_pointer()
362 test("(efault)", "%pE", ERR_PTR(-11)); in error_pointer()
371 test(ZEROS "000000ab", "%px", PTR_INVALID); in invalid_pointer()
372 test("(efault)", "%pE", PTR_INVALID); in invalid_pointer()
406 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee", in hex_string()
408 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee", in hex_string()
417 test("2d:48:d6:fc:7a:05", "%pM", addr); in mac()
418 test("05:7a:fc:d6:48:2d", "%pMR", addr); in mac()
419 test("2d-48-d6-fc-7a-05", "%pMF", addr); in mac()
420 test("2d48d6fc7a05", "%pm", addr); in mac()
421 test("057afcd6482d", "%pmR", addr); in mac()
433 test("127.000.000.001|127.0.0.1", "%pi4|%pI4", &sa.sin_addr, &sa.sin_addr); in ip4()
434 test("127.000.000.001|127.0.0.1", "%piS|%pIS", &sa, &sa); in ip4()
436 test("001.002.003.004:12345|1.2.3.4:12345", "%piSp|%pISp", &sa, &sa); in ip4()
457 test("00010203-0405-0607-0809-0a0b0c0d0e0f", "%pUb", uuid); in uuid()
458 test("00010203-0405-0607-0809-0A0B0C0D0E0F", "%pUB", uuid); in uuid()
459 test("03020100-0504-0706-0809-0a0b0c0d0e0f", "%pUl", uuid); in uuid()
460 test("03020100-0504-0706-0809-0A0B0C0D0E0F", "%pUL", uuid); in uuid()
481 test("foo", "%pd", &test_dentry[0]); in dentry()
482 test("foo", "%pd2", &test_dentry[0]); in dentry()
484 test("(null)", "%pd", NULL); in dentry()
485 test("(efault)", "%pd", PTR_INVALID); in dentry()
486 test("(null)", "%pD", NULL); in dentry()
487 test("(efault)", "%pD", PTR_INVALID); in dentry()
489 test("romeo", "%pd", &test_dentry[3]); in dentry()
490 test("alfa/romeo", "%pd2", &test_dentry[3]); in dentry()
491 test("bravo/alfa/romeo", "%pd3", &test_dentry[3]); in dentry()
492 test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]); in dentry()
493 test("/bravo/alfa", "%pd4", &test_dentry[2]); in dentry()
495 test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]); in dentry()
496 test(" bravo/alfa| bravo/alfa", "%12pd2|%*pd2", &test_dentry[2], 12, &test_dentry[2]); in dentry()
519 test("(%pt?)", "%pt", &tm); in time_and_date()
520 test("2018-11-26T05:35:43", "%ptR", &tm); in time_and_date()
521 test("0118-10-26T05:35:43", "%ptRr", &tm); in time_and_date()
522 test("05:35:43|2018-11-26", "%ptRt|%ptRd", &tm, &tm); in time_and_date()
523 test("05:35:43|0118-10-26", "%ptRtr|%ptRdr", &tm, &tm); in time_and_date()
524 test("05:35:43|2018-11-26", "%ptRttr|%ptRdtr", &tm, &tm); in time_and_date()
525 test("05:35:43 tr|2018-11-26 tr", "%ptRt tr|%ptRd tr", &tm, &tm); in time_and_date()
527 test("2019-01-04T15:32:23", "%ptT", &t); in time_and_date()
528 test("0119-00-04T15:32:23", "%ptTr", &t); in time_and_date()
529 test("15:32:23|2019-01-04", "%ptTt|%ptTd", &t, &t); in time_and_date()
530 test("15:32:23|0119-00-04", "%ptTtr|%ptTdr", &t, &t); in time_and_date()
532 test("2019-01-04 15:32:23", "%ptTs", &t); in time_and_date()
533 test("0119-00-04 15:32:23", "%ptTsr", &t); in time_and_date()
534 test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t); in time_and_date()
535 test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t); in time_and_date()
553 test("1-20,60000-60014", "%*pbl", nbits, bits); in large_bitmap()
565 test("00000|00000", "%20pb|%*pb", bits, 20, bits); in bitmap()
566 test("|", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
570 test("a28ac|a28ac", "%20pb|%*pb", bits, 20, bits); in bitmap()
571 test("2-3,5,7,11,13,17,19|2-3,5,7,11,13,17,19", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
574 test("fffff|fffff", "%20pb|%*pb", bits, 20, bits); in bitmap()
575 test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits); in bitmap()
641 test(cmp_buf, "%pGp", &flags); in page_flags_test()
668 test("read|exec|mayread|maywrite|mayexec", "%pGv", &flags); in flags()
671 test("GFP_TRANSHUGE", "%pGg", &gfp); in flags()
674 test("GFP_ATOMIC|GFP_DMA", "%pGg", &gfp); in flags()
677 test("__GFP_ATOMIC", "%pGg", &gfp); in flags()
682 test(cmp_buffer, "%pGg", &gfp); in flags()
687 test(cmp_buffer, "%pGg", &gfp); in flags()
712 test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1])); in fwnode_pointer()
713 test(full_name, "%pfw", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
714 test(full_name, "%pfwf", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
715 test(second_name, "%pfwP", software_node_fwnode(&softnodes[1])); in fwnode_pointer()
716 test(third_name, "%pfwP", software_node_fwnode(&softnodes[2])); in fwnode_pointer()
735 test(try[i].str, "%p4cc", &try[i].code); in fourcc_pointer()
741 test("-1234", "%pe", ERR_PTR(-1234)); in errptr()
748 test("(-ENOTSOCK)", "(%pe)", ERR_PTR(-ENOTSOCK)); in errptr()
749 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EAGAIN)); in errptr()
751 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EWOULDBLOCK)); in errptr()
752 test("[-EIO ]", "[%-8pe]", ERR_PTR(-EIO)); in errptr()
753 test("[ -EIO]", "[%8pe]", ERR_PTR(-EIO)); in errptr()
754 test("-EPROBE_DEFER", "%pe", ERR_PTR(-EPROBE_DEFER)); in errptr()