File: readblocks.cpp

package info (click to toggle)
python-nixio 1.5.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,888 kB
  • sloc: python: 12,527; cpp: 832; makefile: 25
file content (22 lines) | stat: -rw-r--r-- 736 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
#include "testutil.hpp"
#include <nix.hpp>

int main(int argc, char* argv[]) {
    if (argc != 2) {
        std::cerr << "Please specify a nix file (and nothing else)" << std::endl;
        return 1;
    }
    std::string fname = argv[1];
    nix::File nf = nix::File::open(fname, nix::FileMode::ReadOnly);

    int idx = 0, errcount = 0;
    std::string expname, expdef;
    for (const auto &block : nf.blocks()) {
        expname = "test_block" + nix::util::numToStr(idx);
        expdef = "definition block " + nix::util::numToStr(idx++);
        errcount += compare(expname, block.name());
        errcount += compare("blocktype", block.type());
        errcount += compare(expdef, block.definition());
    }
    return errcount;
}