Content-Length: 1986 | pFad | https://github.com/Repast/repast.hpc/raw/refs/heads/master/scripts/create_error_tests_code.py
th: 1974 #!/usr/bin/env python import sys, os, string def parse_line(line): idx1 = line.find("(") name = line[:idx1] idx2 = line.find("):") args = line[idx1 + 1 : idx2].split(",") return (name, args) def create_code(sig): t = string.Template("""TEST_F(Errors, $name) { $name$t r_error$args; ASSERT_TRUE(string(r_error.what()).size() > 0); try { throw r_error; FAIL(); } catch (std::exception& e) { ASSERT_TRUE(string(e.what()).size() > 0); } }""") args = "" name_t = "" for arg in sig[1]: arg = arg.strip() if arg.startswith("int"): args += (", 0"); elif arg.startswith("double"): args += (", 0.0") elif arg.startswith("std::string") or arg.startswith("const std::string"): args += (", \"foo\"") elif arg.startswith("std::vectorFetched URL: https://github.com/Repast/repast.hpc/raw/refs/heads/master/scripts/create_error_tests_code.py
Alternative Proxies: