1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00

Add more tests for "kernaux_printf_va"

This commit is contained in:
Alex Kotov 2020-12-07 05:49:18 +05:00
parent 9aa9279c26
commit 688cff0d23
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -43,7 +43,39 @@ int main()
test("Hello, Alex!", "Hello, %s!", "Alex");
test("Hello, Alex!", "Hello, %c%c%c%c!", 'A', 'l', 'e', 'x');
test("%", "%%");
test("%%", "%%%%");
test("%%%", "%%%%%%");
test("123", "%u", 123);
test("123456", "%u%u", 123, 456);
test("foo", "%s", "foo");
test("foobar", "%s%s", "foo", "bar");
test("a", "%c", 'a');
test("ab", "%c%c", 'a', 'b');
test("abc", "%c%c%c", 'a', 'b', 'c');
test("%123fooa", "%%%u%s%c", 123, "foo", 'a');
test("%123afoo", "%%%u%c%s", 123, 'a', "foo");
test("%a123foo", "%%%c%u%s", 'a', 123, "foo");
test("%afoo123", "%%%c%s%u", 'a', "foo", 123);
test("%foo123a", "%%%s%u%c", "foo", 123, 'a');
test("%fooa123", "%%%s%c%u", "foo", 'a', 123);
test("123%fooa", "%u%%%s%c", 123, "foo", 'a');
test("123%afoo", "%u%%%c%s", 123, 'a', "foo");
test("a%123foo", "%c%%%u%s", 'a', 123, "foo");
test("a%foo123", "%c%%%s%u", 'a', "foo", 123);
test("foo%123a", "%s%%%u%c", "foo", 123, 'a');
test("foo%a123", "%s%%%c%u", "foo", 'a', 123);
test("123foo%a", "%u%s%%%c", 123, "foo", 'a');
test("123a%foo", "%u%c%%%s", 123, 'a', "foo");
test("a123%foo", "%c%u%%%s", 'a', 123, "foo");
test("afoo%123", "%c%s%%%u", 'a', "foo", 123);
test("foo123%a", "%s%u%%%c", "foo", 123, 'a');
test("fooa%123", "%s%c%%%u", "foo", 'a', 123);
test("123fooa%", "%u%s%c%%", 123, "foo", 'a');
test("123afoo%", "%u%c%s%%", 123, 'a', "foo");
test("a123foo%", "%c%u%s%%", 'a', 123, "foo");
test("afoo123%", "%c%s%u%%", 'a', "foo", 123);
test("foo123a%", "%s%u%c%%", "foo", 123, 'a');
test("fooa123%", "%s%c%u%%", "foo", 'a', 123);
return 0;
}