summaryrefslogtreecommitdiffstats
path: root/runtime/tests/string/printf_B.c
blob: b9bbe170d3255157193c6847495091ff42dd73c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* more printf tests */

/* use very small buffer size for testing */
#define STP_PRINT_BUF_LEN 20
#include "runtime.h"

#define LLONG_MAX    9223372036854775807LL
#define LLONG_MIN    (-LLONG_MAX - 1LL)


int main ()
{
  int i;

  /* a couple of loops showing continuous output */
  for (i = 0; i < 20; i++)
    _stp_sprintf(_stp_stdout, "i=%d ", i);
  _stp_printf("\n");
  _stp_print_flush();

  for (i = 0; i < 5; i++)
    _stp_printf("[%d  %d  %d] ", i, i*i, i*i*i);
  _stp_printf("\n");
  _stp_print_flush();

  int64_t x,y;
  x = LLONG_MAX;
  y = LLONG_MIN;

  _stp_printf("%lld ",x);
  _stp_printf("(%llx) ", x);
  _stp_printf("%lld ",y);
  _stp_printf("(%llx) ", y);
  _stp_printf("\n");
  _stp_print_flush();
  return 0;
}