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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [cxx/] [ustl/] [current/] [tests/] [bvt13.cpp] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// "Testing string reads" 12345678 4321 0x78675645 1.234567890123456
2
// (the above line is the input to this test, so must be at the beginning)
3
//
4
// This file is part of the uSTL library, an STL implementation.
5
//
6
// Copyright (c) 2005-2009 by Mike Sharov <msharov@users.sourceforge.net>
7
// This file is free software, distributed under the MIT License.
8
 
9
#include "stdtest.h"
10
#include <stdio.h>
11
 
12
void TestCoutCinCerr (void)
13
{
14
    string testStr;
15
    cin >> testStr;
16
    if (testStr != "//") {
17
        cout.format ("You must put bvt13.cc on stdin (read \"%s\")\n", testStr.c_str());
18
        return;
19
    }
20
    uint32_t n1 = 0, n3 = 0;
21
    uint16_t n2 = 0;
22
    double f1 = 0.0;
23
    cin >> testStr >> n1 >> n2 >> n3 >> f1;
24
    cout << testStr << endl;
25
    cout << "A string printed to stdout\n";
26
    cout.format ("%d %s: %d, %hd, 0x%08X, %1.15f\n", 4, "numbers", n1, n2, n3, f1);
27
    string testString;
28
    testString.format ("A ustl::string object printed %d times\n", 3);
29
    for (int i = 0; i < 3; ++ i)
30
        cout << testString;
31
    cout.flush();
32
    fprintf (stderr, "All ");
33
    cerr << "done.\n";
34
}
35
 
36
StdBvtMain (TestCoutCinCerr)

powered by: WebSVN 2.1.0

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