Skip to content

Commit

Permalink
fix file paths in explicit_tree_aut_test.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
alan23273850 committed Aug 22, 2024
1 parent 1dc39c3 commit b8beb3b
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions unit_tests/explicit_tree_aut_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,18 @@ BOOST_AUTO_TEST_CASE(Grover_Search)
std::filesystem::path current_path = std::filesystem::current_path();
while (true) {
for (const auto& entry : std::filesystem::directory_iterator(current_path)) {
if (entry.is_directory() && entry.path().filename() == "reference_answers") {
if (entry.is_directory() && entry.path().filename() == "AutoQ") {
goto L;
}
}
std::filesystem::path parent_path = current_path.parent_path();
if (parent_path == current_path) {
std::cout << "The \"" << "reference_answers" << "\" folder was not found in any parent directory.\n";
std::cout << "The \"" << "AutoQ" << "\" folder was not found in any parent directory.\n";
break;
}
current_path = parent_path;
}
L: const auto &file = std::filesystem::absolute(current_path).string() + "/reference_answers/Grover" + std::to_string(n) + ".spec";
L: const auto &file = std::filesystem::absolute(current_path).string() + "/AutoQ/unit_tests/reference_answers/Grover" + std::to_string(n) + ".spec";
auto ans = AUTOQ::Parsing::TimbukParser<AUTOQ::TreeAutomata::Symbol>::ReadAutomaton(file);
// int n = (aut.qubitNum + 1) / 3;
// aut.print_aut();
Expand Down Expand Up @@ -842,7 +842,7 @@ bool is_symbol(std::string file)
BOOST_AUTO_TEST_CASE(HSL_format_checker)
{
for(int i = 0 ; i < 4 ; i++)
{
std::string hsl_file = "/home/johnny/AutoQ/unit_tests/testcase/spec_hsl/HSL/sample"+std::to_string(i)+".hsl";
Expand All @@ -856,7 +856,7 @@ BOOST_AUTO_TEST_CASE(HSL_format_checker)
//aut_spec.print_aut();
//aut_hsl.print_aut();
auto aut_hsl = AUTOQ::Parsing::TimbukParser<AUTOQ::Symbol::Symbolic>::ReadAutomaton(hsl_file);
auto aut_spec = AUTOQ::Parsing::TimbukParser<AUTOQ::Symbol::Predicate>::ReadAutomaton(spec_file);
std::string constraint = "";
Expand All @@ -870,7 +870,7 @@ BOOST_AUTO_TEST_CASE(HSL_format_checker)
// AUTOQ::Constraint C(buffer.str().c_str());
// bool verify_1 = AUTOQ::check_inclusion(C, aut_hsl, aut_spec);
// BOOST_REQUIRE_MESSAGE(verify_1, "");
}
else
Expand All @@ -897,14 +897,14 @@ bool has_dir(const std::string &path)
}
return 0;
}
void search(std::string path, std::list<std::string> &not_found_list)
{
for (const auto & entry : fs::directory_iterator(path))
{
if(!entry.is_directory())
{
continue;
continue;
}
if(has_dir(entry.path().string()))
{
Expand Down Expand Up @@ -971,8 +971,22 @@ BOOST_AUTO_TEST_CASE(file_exist_checker)
namespace fs = std::filesystem;
BOOST_AUTO_TEST_CASE(hsl_rule_checker)
{
std::filesystem::path current_path = std::filesystem::current_path();
while (true) {
for (const auto& entry : std::filesystem::directory_iterator(current_path)) {
if (entry.is_directory() && entry.path().filename() == "AutoQ") {
goto L;
}
}
std::filesystem::path parent_path = current_path.parent_path();
if (parent_path == current_path) {
std::cout << "The \"" << "AutoQ" << "\" folder was not found in any parent directory.\n";
break;
}
current_path = parent_path;
}
//read ./unit_tests/hsl_rule/;
std::string path = "./unit_tests/testcase/";
L: std::string path = std::filesystem::absolute(current_path).string() + "/AutoQ/unit_tests/testcase/";


std::string cir_path = path + "GHZALL/circuit.qasm";
Expand All @@ -990,7 +1004,7 @@ BOOST_AUTO_TEST_CASE(hsl_rule_checker)
if(!verify)
std::cout<<entry.path().string() + " Not verified"<<std::endl;
}


}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b8beb3b

Please sign in to comment.