summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-12-28 15:54:16 +0300
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-12-28 15:54:16 +0300
commit85d5a08b51e24af57120068bed4534e4c1e889f4 (patch)
tree0bab5217d4ea83929d314c2ce29f962a949c95c8 /unittest
parentece5ad57e9b2505732be4b043440d9e5a5dc3b9a (diff)
parent31cd0643ae1b5670d4ebd89eb001f2bcda400d2a (diff)
downloadmariadb-git-85d5a08b51e24af57120068bed4534e4c1e889f4.tar.gz
Manual merge of WL#4738 from mysql-next-mr:
- backported code that handles %f/%g arguments in my_vsnprintf.c from 6.0 - backported %f/%g tests in unittest/mysys/my_vsnprintf-t.c from 6.0 - replaced snprintf("%g") in sql/set_var.cc with my_gcvt() - removed unnecessary "--replace-result"s for Windows in mysql-test/suite/sys_vars/t/long_query_time_basic.test - some test results adjustments
Diffstat (limited to 'unittest')
-rw-r--r--unittest/mysys/my_vsnprintf-t.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c
index f3a6b5700da..4ef6c310c8f 100644
--- a/unittest/mysys/my_vsnprintf-t.c
+++ b/unittest/mysys/my_vsnprintf-t.c
@@ -31,7 +31,7 @@ void test1(const char *res, const char *fmt, ...)
int main(void)
{
- plan(47);
+ plan(54);
test1("Constant string",
"Constant string");
@@ -46,12 +46,18 @@ int main(void)
"Format specifier d %d", 1);
test1("Format specifier u 2",
"Format specifier u %u", 2);
+ test1("Format specifier o 375",
+ "Format specifier o %o", 0375);
test1("Format specifier x a",
"Format specifier x %x", 10);
test1("Format specifier X B",
"Format specifier X %X", 11);
test1("Format specifier p 0x5",
"Format specifier p %p", 5);
+ test1("Format specifier f 3.141593",
+ "Format specifier f %f", 3.1415926);
+ test1("Format specifier g 3.1416",
+ "Format specifier g %g", 3.1415926);
test1("Flag '-' is ignored < 1>",
"Flag '-' is ignored <%-4d>", 1);
@@ -71,6 +77,9 @@ int main(void)
test1("Length modifiers work: 1 * -1 * 2 * 3",
"Length modifiers work: %d * %ld * %lld * %zd", 1, -1L, 2LL, (size_t)3);
+ test1("long long X: 123456789abcdef0",
+ "long long X: %llx", 0x123456789abcdef0LL);
+
test1("(null) pointer is fine",
"%s pointer is fine", NULL);
@@ -93,12 +102,18 @@ int main(void)
test1("Positional arguments and a width: <0000ab>",
"Positional arguments and a width: <%1$06x>", 0xab);
+ test1("Positional arguments octal: <7777>",
+ "Positional arguments octal: <%1$o>", 07777);
+
test1("Padding and %p <0x12> <0x034> <0x0000ab> < 0xcd>",
"Padding and %%p <%04p> <%05p> <%08p> <%8p>", 0x12, 0x34, 0xab, 0xcd);
-#if MYSQL_VERSION_ID > 60000
-#error %f/%g tests go here
-#endif
+ test1("F with a width (ignored) and precision: <12.34568>",
+ "F with a width (ignored) and precision: <%10.5f>", 12.3456789);
+ test1("G with a width (ignored) and precision: <12.35>",
+ "G with a width (ignored) and precision: <%10.5g>", 12.3456789);
+
+ diag("================================================================");
test1("Hello",
"Hello");