From 2b7c7ee780f1e08fda463a55df15197eb5b95572 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 14 Oct 2021 23:47:48 +0200 Subject: [PATCH] Rewrite tests --- code/test/getstring.c | 17 ++++++++--------- code/test/putstring.c | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/code/test/getstring.c b/code/test/getstring.c index a90b50b..1cb6a89 100644 --- a/code/test/getstring.c +++ b/code/test/getstring.c @@ -1,13 +1,12 @@ #include "syscall.h" +#define MAX_INPUT_SIZE 4 -int main() -{ - //char s; - //s = GetChar(); - //PutChar(s); +int main(){ char t[100]; - GetString(t, 100); - PutString(t); - PutChar('\n'); - PutString("Ceci est un test de grande ampleur"); + do { + GetString(t, MAX_INPUT_SIZE); + PutString(t); + PutChar('\n'); + } + while(1 == 1); } diff --git a/code/test/putstring.c b/code/test/putstring.c index 8e0da84..af0e09f 100644 --- a/code/test/putstring.c +++ b/code/test/putstring.c @@ -2,14 +2,15 @@ int main() { - // PutString("Te\n"); - // PutString("Tes\n"); - // PutString("Tes t\n"); - // // les deux derniers ne fonctionnent pas car ila dépassent la taille du - // // buffer: MAX_STRING_SIZE - // // - // // Maitenant que j'ai fais une boucle dans PutString, tout fonctionne bien - PutString("BonjourTout\n"); - PutString("Bonjour tout le monde\n"); - Exit(4); + //Test simple : 1 mot plus petit que le buffer + PutString("Hello"); + //puis un mot avec un saut de ligne + PutString("Hello\n"); + //cette fois plus grand que le buffer + PutString("Hello World!\n"); + // Puis une chaine plus longue + PutString("Ceci est une chaine vraiment très longue, on peut méme faire un peu plus long!\n"); + // des saut de lignes dans la phrace + PutString("bonjour,\nJe voudrais par la présente\nTester mon appel système\navec des saut de lignes\nCordialement,\n\nToto\n"); + Exit(0); }