Changeset 2d11a7d8 in mainline for uspace/app/tester/print/print2.c


Ignore:
Timestamp:
2009-06-30T15:54:14Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c40f88
Parents:
db24058
Message:

tester framework rewrite (go from a menu-driven interface to command-line interface)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/print/print2.c

    rdb24058 r2d11a7d8  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2005 Josef Cejka
    33 * All rights reserved.
    44 *
     
    2929#include <stdio.h>
    3030#include <unistd.h>
    31 #include <errno.h>
    3231#include "../tester.h"
    3332
    34 char * test_hangup(bool quiet)
     33char *test_print2(void)
    3534{
    36         char c;
    37         int res;
    38         int phoneid;
    39 
    40         printf("Select phoneid to hangup: 2-9 (q to skip)\n");
    41         do {
    42                 c = getchar();
    43                 if ((c == 'Q') || (c == 'q'))
    44                         return TEST_SKIPPED;
    45         } while (c < '2' || c > '9');
    46         phoneid = c - '0';
     35        TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
     36        TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
     37        TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
    4738       
    48         printf("Hanging up...");
    49         res = ipc_hangup(phoneid);
    50         printf("done: %d\n", phoneid); 
     39        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
     40        TPRINTF("Expected output: [1] [ 02] [03 ] [004] [005]\n");
     41        TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", 1, 2, 3, 4, 5);
     42       
     43        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", -1, -2, -3, -4, -5):\n");
     44        TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
     45        TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5);
     46       
     47        TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n");
     48        TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n");
     49        TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
    5150       
    5251        return NULL;
Note: See TracChangeset for help on using the changeset viewer.