aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_strtoll_dec.in
blob: f4d2950e4bf0f21a17c7f046a6d5ee13d09443a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>

int main() {
  const char *STRING = "4 -38 +4711";
  char *end_char;

  // undefined base
  long long int l1 = strtoll(STRING, &end_char, 0);
  long long int l2 = strtoll(end_char, &end_char, 0);
  long long int l3 = strtoll(end_char, NULL, 0);

  // defined base
  long long int l4 = strtoll(STRING, &end_char, 10);
  long long int l5 = strtoll(end_char, &end_char, 10);
  long long int l6 = strtoll(end_char, NULL, 10);

  printf("%d%d%d%d%d%d\n", l1 == 4, l2 == -38, l3 == 4711, l4 == 4, l5 == -38,
         l6 == 4711);
  return 0;
}