File: driver.cc

package info (click to toggle)
bobcat 1.18.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,920 kB
  • ctags: 575
  • sloc: makefile: 12,973; cpp: 6,284; perl: 401; ansic: 68; sh: 52
file content (53 lines) | stat: -rw-r--r-- 964 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef INCLUDED_IOSTREAM_
#include <iostream>
#define INCLUDED_IOSTREAM_
#endif

#ifndef INCLUDED_ISTREAM_
#include <istream>
#define INCLUDED_ISTREAM_
#endif

#ifndef INCLUDED_RANDBUFFER_H_
#include "../randbuffer.h"
#endif

using namespace std;
using namespace FBB;

int main(int argc, char **argv, char **envp)
{
    if (argc == 1)
    {
        cout << "expect: nruns min max seed\n";
        return 1;
    }

    
    Randbuffer rb(atoi(argv[2]), atoi(argv[3]), atoi(argv[4]));

    istream istr(&rb);

    for (int idx = atoi(argv[1]); idx--; )
    {
        int c;
        if (!(istr >> c))
        {
            cout << "extraction failed\n";
            break;
        }    
        cout << "next: " << c << endl;
    }

    int count = 0;
    while (istr.unget())
        count++;

    cout << "number of successful unget()-calls: " << count << endl;
    istr.clear();
    istr >> count;
    cout << "and read: " << count << endl;
    
    return 0;
}