| 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; |
| 13 | std::string expname, expdef; |
| 14 | for (const auto &block : nf.blocks()) { |
| 15 | expname = "test_block" + nix::util::numToStr(idx); |
| 16 | expdef = "definition block " + nix::util::numToStr(idx++); |
| 17 | errcount += compare(expname, block.name()); |
| 18 | errcount += compare("blocktype", block.type()); |
| 19 | errcount += compare(expdef, block.definition()); |
| 20 | } |
| 21 | return errcount; |
| 22 | } |