Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
Functions | Variables
printf.c File Reference
#include <stdio.h>
Include dependency graph for printf.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 CESTER_BODY (static volatile char *nullByte(void) { volatile char *p=0;__asm__("" :"+r"(p));return p;})
 
 cester_assert_int_eq (5, r)
 
 cester_assert_int_eq ('x', b[0])
 
 cester_assert_int_eq ('x', b[1])
 
 CESTER_TEST (snprintfTruncates, test_instance, char b[4]={ 'x', 'x', 'x', 'x' };int r;r=snprintf(b, 3, "%d-%s", 42, "ab");cester_assert_int_eq(5, r);cester_assert_str_equal("42", b);cester_assert_int_eq('x', b[3]);) CESTER_TEST(snprintfMeasureThenFormat
 
 cester_assert_int_eq ('Z', *zero)
 
 cester_assert_int_eq (5, n)
 
 cester_assert_str_equal ("42-ab", b)
 

Variables

int r = snprintf(b + 1, 0, "%d-%s", 42, "ab")
 
 test_instance
 
volatile char * zero = nullByte()
 
char saved = *zero
 
char b [16]
 
int n = snprintf(NULL, 0, "%d-%s", 42, "ab")
 

Function Documentation

◆ cester_assert_int_eq() [1/5]

cester_assert_int_eq ( 'x'  ,
b  [0] 
)

◆ cester_assert_int_eq() [2/5]

cester_assert_int_eq ( 'x'  ,
b  [1] 
)

◆ cester_assert_int_eq() [3/5]

cester_assert_int_eq ( 'Z'  ,
*  zero 
)

◆ cester_assert_int_eq() [4/5]

cester_assert_int_eq ( 5  ,
n   
)

◆ cester_assert_int_eq() [5/5]

cester_assert_int_eq ( 5  ,
r   
)

◆ cester_assert_str_equal()

cester_assert_str_equal ( "42-ab"  ,
b   
)

◆ CESTER_BODY()

CESTER_BODY ( static volatile char *nullByte(void) { volatile char *p=0;__asm__("" :"+r"(p));return p;}   )

◆ CESTER_TEST()

CESTER_TEST ( snprintfTruncates  ,
test_instance  ,
char  b[4] = { 'x', 'x', 'x', 'x' }; int r; r = snprintf(b, 3, "%d-%s", 42, "ab"); cester_assert_int_eq(5, r); cester_assert_str_equal("42", b); cester_assert_int_eq('x', b[3]); 
)

Variable Documentation

◆ b

char b[16]

◆ n

n = snprintf(NULL, 0, "%d-%s", 42, "ab")

◆ r

r = snprintf(b + 1, 0, "%d-%s", 42, "ab")

◆ saved

char saved = *zero

◆ test_instance

test_instance

◆ zero

* zero = nullByte()