File: readdataframes.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 (34 lines) | stat: -rw-r--r-- 1,235 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
#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, df_no = 7;
    std::string expname, exptp;
    std::vector<nix::Variant> idx_col(4), com_col(4);
    const auto &block = nf.getBlock("test_block");
    for (const auto &df : block.dataFrames()) {
        expname = "df_" + nix::util::numToStr(idx);
        errcount += compare(true, block.hasDataFrame(expname));
        if (idx == 4){
            errcount += compare(6, static_cast<int>(df.columns().size()));
            } else if (idx == 5) {
        errcount += compare(5, static_cast<int>(df.rows()));
        } else{
            errcount += compare(5, static_cast<int>(df.columns().size()));
            errcount += compare(4, static_cast<int>(df.rows()));
            }

        exptp = "df type " + nix::util::numToStr(idx++);
        errcount += compare(expname, df.name());
        errcount += compare(exptp, df.type());
    }
    errcount += compare(idx, df_no);
    return errcount;
}