| 1 | #include "testutil.hpp" |
| 2 | #include <nix.hpp> |
| 3 | |
| 4 | |
| 5 | int main(int argc, char* argv[]) { |
| 6 | if (argc != 2) { |
| 7 | std::cerr << "Please specify a nix file (and nothing else)" << std::endl; |
| 8 | return 1; |
| 9 | } |
| 10 | std::string fname = argv[1]; |
| 11 | nix::File nf = nix::File::open(fname, nix::FileMode::ReadOnly); |
| 12 | |
| 13 | int idx = 0, errcount = 0; |
| 14 | std::string expname, expdef; |
| 15 | const auto &block = nf.getBlock("test_block"); |
| 16 | for (const auto &group : block.groups()) { |
| 17 | expname = "group_" + nix::util::numToStr(idx); |
| 18 | expdef = "group definition " + nix::util::numToStr(10 * idx++); |
| 19 | errcount += compare(expname, group.name()); |
| 20 | errcount += compare("grouptype", group.type()); |
| 21 | errcount += compare(expdef, group.definition()); |
| 22 | } |
| 23 | return errcount; |
| 24 | } |