1
0
Fork 0
mirror of synced 2025-07-04 04:17:02 +02:00

Failing Testcases for printf

This commit is contained in:
Christian Dietrich 2014-09-29 20:39:23 +02:00
parent 24fbf1c376
commit 6183531abd
8 changed files with 151 additions and 21 deletions

47
tests/float.c Normal file
View file

@ -0,0 +1,47 @@
#include <avr/io.h>
#include <stdio.h>
static int uart_putchar(char c, FILE *stream);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
_FDEV_SETUP_WRITE);
static int
uart_putchar(char c, FILE *stream)
{
UDR = c;
return 0;
}
volatile uint16_t xxx = 65;
int
main(void)
{
stdout = &mystdout;
printf("Hello, world!");
asm volatile("break;");
volatile float foo = 0.23;
printf("%.2f", foo);
asm volatile("break;");
return 0;
}
/**
check-name: Print to Stdout and Float
check-start:
\avr@instr@stepn{100000}
\avr@test@UDR{Hello, world!}
\xdef\avr@UDR{}
\avr@instr@stepn{100000}
\avr@test@UDR{0.23}
\def\avr@UDR{}
check-end:
**/

View file

@ -13,6 +13,13 @@ int main() {
foo[4] = foo[1] % foo[0];
volatile uint16_t x = 1000;
volatile uint16_t y = 55;
foo[5] = x * y;
itoa(165, &foo[6], 10);
asm volatile ("break");
}
@ -28,5 +35,11 @@ int main() {
\avr@test@MEM{99}{00000001} % 1
\avr@test@MEM{100}{00010011} % 19
\avr@test@MEM{101}{11011000} % 216
\avr@test@MEM{102}{00110001} % '1'
\avr@test@MEM{103}{00110110} % '6'
\avr@test@MEM{104}{00110101} % '5'
check-end:
*/

36
tests/printf.c Normal file
View file

@ -0,0 +1,36 @@
#include <avr/io.h>
#include <stdio.h>
volatile char buffer[30];
volatile uint16_t xxx = 165;
int
main(void)
{
asm volatile("break;");
// sprintf(buffer, "%d", xxx);
__ultoa_invert(xxx, buffer, 10);
asm volatile("break;");
return 0;
}
/**
check-name: Print to Stdout
check-start:
\avr@instr@stepn{100000}
\avr@instr@executed=0
\avr@instr@stepn{100000}
\avr@test@MEM{96}{00110001} % '1'
\avr@test@MEM{97}{00110110} % '6'
\avr@test@MEM{98}{00110101} % '5'
check-end:
**/

View file

@ -93,10 +93,10 @@ do_test()
fi
test_name=$last_result
echo "TEST $test_name ($file)"
echo -n "TEST $test_name ($file)"
cp HEADER "$file".tex
echo "\avrloadc{$file}" >> "$file".tex
echo "\avrloadc[-lm -Os -mmcu=atmega8]{$file}" >> "$file".tex
awk '/check-start/,/check-end/ {print}' $file \
| egrep -v 'check-(start|end)' >> "$file".tex
@ -109,6 +109,7 @@ do_test()
rm -f *.log *.aux *.pdf
if [ "$actual_exit_value" -ne 0 ]; then
echo
error " Actual exit value does not match the expected one."
error " expected 0, got $actual_exit_value"
if [ x"$V" = x"1" ]; then
@ -117,6 +118,9 @@ do_test()
tail -n 10 $file.output | sed 's/^/ /'
fi
test_failed=1
else
get_value BREAK "$file".output
echo " ($last_result)"
fi
if [ "$test_failed" -eq "1" ]; then