Merge pull request #128 from logxen/edge
[clinton/Smoothieware.git] / gcc4mbed / samples / StdIO / main.cpp
1 /* Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 */
15 /* Basic unit test for C Standard I/O routines. */
16 #include "mbed.h"
17
18
19 int main()
20 {
21 int Value = -1;
22
23 printf("\r\n\r\nGCC4MBED Test Suite\r\n");
24 printf("Standard I/O Unit Tests\r\n");
25
26 printf("Test 1: printf() test\r\n");
27
28 printf("Test 2: scanf() test\r\n");
29 printf(" Type number and press Enter: ");
30 scanf("%d", &Value);
31 printf("\n Your value was: %d\r\n", Value);
32
33 fprintf(stdout, "Test 3: fprintf(stdout, ...) test\r\n");
34
35 fprintf(stderr, "Test 4: fprintf(stderr, ...) test\r\n");
36
37 printf("Test 5: fscanf(stdin, ...) test\r\n");
38 printf(" Type number and press Enter: ");
39 fscanf(stdin, "%d", &Value);
40 printf("\n Your value was: %d\r\n", Value);
41
42 printf("Test complete\r\n");
43
44 for(;;)
45 {
46 }
47 }