Subversion Repositories HelenOS-historic

Rev

Rev 1196 | Rev 1735 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1196 Rev 1271
Line 26... Line 26...
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
#include <print.h>
28
#include <print.h>
29
#include <test.h>
29
#include <test.h>
30
 
30
 
-
 
31
#define BUFFER_SIZE 32
-
 
32
 
31
void test(void)
33
void test(void)
32
{
34
{
33
    __native nat = 0x12345678u;
35
    __native nat = 0x12345678u;
-
 
36
   
-
 
37
    unsigned char buffer[BUFFER_SIZE];
-
 
38
   
34
    printf(" Printf test \n");
39
    printf(" Printf test \n");
35
   
40
   
36
    printf(" text 10.8s %*.*s \n", 5, 3, "text");
41
    printf(" text 10.8s %*.*s \n", 5, 3, "text");
37
    printf(" very long text 10.8s %10.8s \n", "very long text");
42
    printf(" very long text 10.8s %10.8s \n", "very long text");
38
    printf(" text 8.10s %8.10s \n", "text");
43
    printf(" text 8.10s %8.10s \n", "text");
Line 44... Line 49...
44
    printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 );
49
    printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 );
45
 
50
 
46
    printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zX'. '%#llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" );
51
    printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zX'. '%#llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" );
47
   
52
   
48
    printf(" Print to NULL '%s'\n",NULL);
53
    printf(" Print to NULL '%s'\n",NULL);
-
 
54
 
-
 
55
    printf("Print short text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
-
 
56
    snprintf(buffer, BUFFER_SIZE, "Short %s", "text");
-
 
57
    printf("Result is: '%s'\n", buffer);
-
 
58
   
-
 
59
    printf("Print long text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
-
 
60
    snprintf(buffer, BUFFER_SIZE, "Very long %s. This text`s length is more than %d. We are interested in the result.", "text" , BUFFER_SIZE);
-
 
61
    printf("Result is: '%s'\n", buffer);
-
 
62
   
49
    return;
63
    return;
50
}
64
}