Skip to content

Commit

Permalink
func(demo): update chain_output function for new signature
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Jul 26, 2024
1 parent 120dcd2 commit 26c268c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions func/demo/chain_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,37 @@ int main(int argc, char* argv[])
unsigned int callIdB = faasmChain(otherB, nullptr, 0);

std::string expectedA = "expected A";
std::string actualA;
actualA.reserve(expectedA.size());

std::string expectedB = "longer expected B";
std::string actualB;
actualB.reserve(expectedB.size());

std::string actualA;
char* actualABuf;
int actualABufSize;
unsigned int resA =
faasmAwaitCallOutput(callIdA, actualA.c_str(), actualA.size());
faasmAwaitCallOutput(callIdA, &actualABuf, &actualABufSize);
actualA.assign(actualABuf, actualABuf + actualABufSize);

std::string actualB;
char* actualBBuf;
int actualBBufSize;
unsigned int resB =
faasmAwaitCallOutput(callIdB, actualB.c_str(), actualB.size());
faasmAwaitCallOutput(callIdB, &actualBBuf, &actualBBufSize);
actualB.assign(actualBBuf, actualBBuf + actualBBufSize);

if (resA != 0 || resB != 0) {
printf("One or more chained calls failed: %i %i\n", resA, resB);
return 1;
}

if (actualA != expectedA) {
printf(
"Output mismatch: %s != %s\n", actualA.c_str(), expectedA.c_str());
return 1;
}

if (actualB != expectedB) {
printf(
"Output mismatch: %s != %s\n", actualB.c_str(), expectedB.c_str());
return 1;
}

Expand Down

0 comments on commit 26c268c

Please sign in to comment.