MCPcopy Create free account
hub / github.com/MariaDB/server / test_d2b2d

Function test_d2b2d

strings/decimal.c:2688–2709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2686}
2687
2688void test_d2b2d(const char *str, int p, int s, const char *orig, int ex)
2689{
2690 char s1[100], *end;
2691 uchar buf[100];
2692 int res, i, size=decimal_bin_size(p, s);
2693
2694 snprintf(s1, sizeof(s1), "'%s'", str);
2695 end= strend(str);
2696 string2decimal(str, &a, &end);
2697 res=decimal2bin(&a, buf, p, s);
2698 printf("%-31s {%2d, %2d} => res=%d size=%-2d ", s1, p, s, res, size);
2699 if (full)
2700 {
2701 printf("0x");
2702 for (i=0; i < size; i++)
2703 printf("%02x", ((uchar *)buf)[i]);
2704 }
2705 res=bin2decimal(buf, &a, p, s);
2706 printf(" => res=%d ", res);
2707 print_decimal(&a, orig, res, ex);
2708 printf("\n");
2709}
2710
2711void test_f2d(double from, int ex)
2712{

Callers 1

mainFunction · 0.85

Calls 5

decimal_bin_sizeFunction · 0.85
strendFunction · 0.85
decimal2binFunction · 0.85
bin2decimalFunction · 0.85
print_decimalFunction · 0.70

Tested by

no test coverage detected