OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [testsuite/] [libgloss.all/] [io.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/*
2
 io.c -- Test the serial I/O.
3
 */
4
 
5
#define BUFSIZE 80
6
#include <stdio.h>
7
 
8
main()
9
{
10
  char buf[100];
11
  char *tmp;
12
  int result;
13
 
14
  /* test the lowest level output function */
15
  result = outbyte ('&');
16
  if (result != 0x0) {
17
    pass ("outbyte");
18
  } else {
19
    fail ("outbyte");
20
  }
21
 
22
  /* try writing a string */
23
  result = write ("Write Test:\n", 12);
24
  print ("result was ");
25
  putnum (result);
26
  outbyte ('\n');
27
  if (result == 12) {
28
    pass ("write");
29
  } else {
30
    fail ("write");
31
  }
32
 
33
  /* try the print() function too */
34
  result = print ("Print Test:\n");
35
  print ("result was ");
36
  putnum (result);
37
  outbyte ('\n');
38
  if (result == 12) {
39
    pass ("print");
40
  } else {
41
    fail ("print");
42
  }
43
 
44
  /* try the iprintf() function too */
45
  result = print ("Iprintf Test:\n");
46
  print ("result was ");
47
  putnum (result);
48
  outbyte ('\n');
49
  if (result == 14) {
50
    pass ("iprintf");
51
  } else {
52
    fail ("iprintf");
53
  }
54
 
55
  /* try to read a string */
56
  print ("Type 5 characters");
57
 
58
  result = 0;
59
  result = read (0, buf, 5);
60
  print (buf);
61
  if (result == 5) {
62
    pass ("read");
63
  } else {
64
    fail ("read");
65
  }
66
 
67
  /* clear everything out */
68
  fflush (stdout);
69
}
70
 
71
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.