Skip to content

Commit e21ec84

Browse files
committed
Fix test
1 parent 4bd5415 commit e21ec84

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

tests/execution_from_ssp_custom_algo_test.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ int main()
6363

6464
size_t numSlaves = cosim_execution_get_num_slaves(execution);
6565

66+
if (numSlaves != 2) {
67+
fprintf(stderr, "Expected numSlaves = 2; got %zu\n", numSlaves);
68+
goto Lfailure;
69+
}
70+
6671
cosim_slave_info infos[2];
6772
rc = cosim_execution_get_slave_infos(execution, &infos[0], numSlaves);
6873
if (rc < 0) { goto Lerror; }
6974

7075
char name[SLAVE_NAME_MAX_SIZE];
7176
int found_slave = 0;
7277
for (size_t i = 0; i < numSlaves; i++) {
73-
strncpy(name, infos[i].name, SLAVE_NAME_MAX_SIZE - 1);
74-
name[SLAVE_NAME_MAX_SIZE - 1] = '\0';
78+
strcpy(name, infos[i].name);
7579
if (0 == strncmp(name, "KnuckleBoomCrane", SLAVE_NAME_MAX_SIZE)) {
7680
found_slave = 1;
7781
double value = -1;

tests/execution_from_ssp_test.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,19 @@ int main()
5454

5555
size_t numSlaves = cosim_execution_get_num_slaves(execution);
5656

57+
if (numSlaves != 2) {
58+
fprintf(stderr, "Expected numSlaves = 2; got %zu\n", numSlaves);
59+
goto Lfailure;
60+
}
61+
5762
cosim_slave_info infos[2];
5863
rc = cosim_execution_get_slave_infos(execution, &infos[0], numSlaves);
5964
if (rc < 0) { goto Lerror; }
6065

6166
char name[SLAVE_NAME_MAX_SIZE];
6267
int found_slave = 0;
6368
for (size_t i = 0; i < numSlaves; i++) {
64-
strncpy(name, infos[i].name, SLAVE_NAME_MAX_SIZE - 1);
65-
name[SLAVE_NAME_MAX_SIZE - 1] = '\0';
69+
strcpy(name, infos[i].name);
6670
if (0 == strncmp(name, "KnuckleBoomCrane", SLAVE_NAME_MAX_SIZE)) {
6771
found_slave = 1;
6872
double value = -1;

0 commit comments

Comments
 (0)