File: path-test.cpp

package info (click to toggle)
exiv2 0.24-4.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,904 kB
  • ctags: 7,389
  • sloc: cpp: 65,740; sh: 10,246; ansic: 1,622; makefile: 654; python: 210; awk: 92; sed: 16; perl: 5
file content (36 lines) | stat: -rw-r--r-- 945 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
// ***************************************************************** -*- C++ -*-
// path-test.cpp, $Rev: 3090 $

#include "utils.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>

int main(int argc, char* const argv[])
{
    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " file\n";
        return 1;
    }
    std::ifstream file(argv[1]);
    if (!file) {
        std::cerr << *argv[1] << ": Failed to open file for reading\n";
        return 1;
    }
    std::string line;
    while (std::getline(file, line)) {
        std::string path, dir, base;
        std::istringstream is(line);
        is >> path >> dir >> base;
        std::string d = Util::dirname(path);
        std::string b = Util::basename(path);

        if (d != dir || b != base) {
            std::cout << path << "\t'" << d << "'\t '" << b
                      << "'\t ==> Testcase failed\n";
        }
    }

    return 0;
}