Skip to content

Commit

Permalink
Added lf_reactor_name function
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Dec 29, 2024
1 parent 1f3844d commit 54d68cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions test/C/src/ReactorName.lf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ reactor A(parent_bank_index: size_t = 0) {
char buffer[20];
snprintf(buffer, 20, "ReactorName.b[%zu].a", self->parent_bank_index);
if (strcmp(buffer, name) != 0) {
lf_print_error_and_exit("full name does not match");
}
name = lf_reactor_name(self);
if (strcmp("a", name) != 0) {
lf_print_error_and_exit("name does not match");
}
=}
Expand All @@ -26,6 +30,11 @@ reactor B(bank_index: size_t = 0) {
lf_print("name: %s", name);
char buffer[20];
snprintf(buffer, 20, "ReactorName.b[%zu]", self->bank_index);
if (strcmp(buffer, name) != 0) {
lf_print_error_and_exit("full name does not match");
}
name = lf_reactor_name(self);
snprintf(buffer, 20, "b[%zu]", self->bank_index);
if (strcmp(buffer, name) != 0) {
lf_print_error_and_exit("name does not match");
}
Expand All @@ -38,6 +47,10 @@ main reactor {
reaction(startup) {=
const char* name = lf_reactor_full_name(self);
lf_print("name: %s", name);
if (strcmp("ReactorName", name) != 0) {
lf_print_error_and_exit("full name does not match");
}
name = lf_reactor_name(self);
if (strcmp("ReactorName", name) != 0) {
lf_print_error_and_exit("name does not match");
}
Expand Down

0 comments on commit 54d68cb

Please # to comment.