Skip to content

Commit

Permalink
add test for heuristic_init_macro
Browse files Browse the repository at this point in the history
  • Loading branch information
jingkaimori committed Jul 9, 2024
1 parent 4e3f18b commit eced5e6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/moebius/drd/drd_info_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** \file drd_info_test.cpp
* \copyright GPLv3
* \details Unitests for drd data structure
* \author jingkaimori
* \date 2024
*/

#include "moe_doctests.hpp"
#include "moebius\drd\drd_info.hpp"
#include "tree_helper.hpp"

using namespace moebius;

using moebius::drd::drd_info;

TEST_CASE ("drd initialize macro") {
drd_info test_drd ("test");
test_drd->heuristic_init_macro (
"test-macro",
tree (MACRO, "arg1", "arg2",
tree (CONCAT, tree (ARG, "arg1"), " text ", tree (ARG, "arg2"))));
tree_label test_macro_label= make_tree_label ("test-macro");
CHECK_EQ (test_drd->get_arity_base (test_macro_label), 2);
CHECK_EQ (test_drd->get_arity_extra (test_macro_label), 0);
CHECK_EQ (test_drd->get_arity_mode (test_macro_label), ARITY_NORMAL);
CHECK_EQ (test_drd->get_nr_indices (test_macro_label), 2);
}

0 comments on commit eced5e6

Please sign in to comment.