| 1 | #include "testutil.hpp" |
| 2 | #include <nix.hpp> |
| 3 | |
| 4 | int main(int argc, char* argv[]) { |
| 5 | if (argc != 2) { |
| 6 | std::cerr << "Please specify a nix file (and nothing else)" << std::endl; |
| 7 | return 1; |
| 8 | } |
| 9 | std::string fname = argv[1]; |
| 10 | nix::File nf = nix::File::open(fname, nix::FileMode::ReadOnly); |
| 11 | |
| 12 | int idx = 0, errcount = 0, df_no = 7; |
| 13 | std::string expname, exptp; |
| 14 | std::vector<nix::Variant> idx_col(4), com_col(4); |
| 15 | const auto &block = nf.getBlock("test_block"); |
| 16 | for (const auto &df : block.dataFrames()) { |
| 17 | expname = "df_" + nix::util::numToStr(idx); |
| 18 | errcount += compare(true, block.hasDataFrame(expname)); |
| 19 | if (idx == 4){ |
| 20 | errcount += compare(6, static_cast<int>(df.columns().size())); |
| 21 | } else if (idx == 5) { |
| 22 | errcount += compare(5, static_cast<int>(df.rows())); |
| 23 | } else{ |
| 24 | errcount += compare(5, static_cast<int>(df.columns().size())); |
| 25 | errcount += compare(4, static_cast<int>(df.rows())); |
| 26 | } |
| 27 | |
| 28 | exptp = "df type " + nix::util::numToStr(idx++); |
| 29 | errcount += compare(expname, df.name()); |
| 30 | errcount += compare(exptp, df.type()); |
| 31 | } |
| 32 | errcount += compare(idx, df_no); |
| 33 | return errcount; |
| 34 | } |