Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
huynhtrankhanh committed Oct 27, 2023
1 parent 1095d66 commit 55fb26b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions compiler/cppCodegen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ procedure("fibonacci", { n: int32, a: int32, b: int32, i: int32 }, () => {
divide(2, 3)
sDivide(1, 2)
divide(readChar(), coerceInt8(3))
sDivide(readChar(), readChar())
call("pointless", { preset: 100 })
call("pointless", {})
Expand All @@ -41,6 +44,8 @@ procedure("fibonacci", { n: int32, a: int32, b: int32, i: int32 }, () => {
if (less(get("n"), 200) || true && !false) {
writeChar(100);
}
if (less(readChar() + readChar(), coerceInt8(3)) && sLess(readChar(), readChar())) {}
});`

const transformer = new CoqCPASTTransformer(code)
Expand Down Expand Up @@ -76,23 +81,27 @@ int main() {
local_2 = uint64_t(1);
environment_0[uint64_t(0)] = { local_1 };
environment_0[uint64_t(1)] = { local_2 };
for (uint64_t binder_0 = 0; binder_0 < binaryOp([&]() { return local_0; }, [&]() { return uint64_t(2); }, [&](auto a, auto b) { return a - b; }); binder_0++) {
local_3 = binaryOp([&]() { return get<0>(environment_0[binder_0]); }, [&]() { return get<0>(environment_0[binaryOp([&]() { return binder_0; }, [&]() { return uint64_t(1); }, [&](auto a, auto b) { return a + b; })]); }, [&](auto a, auto b) { return a + b; });
environment_0[binaryOp([&]() { return binder_0; }, [&]() { return uint64_t(2); }, [&](auto a, auto b) { return a + b; })] = { local_3 };
for (uint64_t binder_0 = 0; binder_0 < (local_0 - uint64_t(2)); binder_0++) {
local_3 = (get<0>(environment_0[binder_0]) + get<0>(environment_0[(binder_0 + uint64_t(1))]));
environment_0[(binder_0 + uint64_t(2))] = { local_3 };
break;
continue;
flushSTDOUT();
}
binaryOp([&]() { return uint64_t(2); }, [&]() { return uint64_t(3); }, [&](auto a, auto b) { return a / b; });
binaryOp([&]() { return toSigned(uint64_t(1)); }, [&]() { return toSigned(uint64_t(2)); }, [&](auto a, auto b) { return a / b; });
(uint64_t(2) / uint64_t(3));
(toSigned(uint64_t(1)) / toSigned(uint64_t(2)));
binaryOp([&]() { return readChar(); }, [&]() { return uint8_t(uint64_t(3)); }, [&](auto a, auto b) { return a / b; });
binaryOp([&]() { return toSigned(readChar()); }, [&]() { return toSigned(readChar()); }, [&](auto a, auto b) { return a / b; });
procedure_0(uint64_t(100));
procedure_0(0);
if (binaryOp([&]() { return local_0; }, [&]() { return uint64_t(100); }, [&](auto a, auto b) { return a == b; })) {
if ((local_0 == uint64_t(100))) {
writeChar(uint64_t(32));
}
if (binaryOp([&]() { return local_0; }, [&]() { return uint64_t(200); }, [&](auto a, auto b) { return a < b; }) || true && (!false)) {
if ((local_0 < uint64_t(200)) || true && (!false)) {
writeChar(uint64_t(100));
}
if (binaryOp([&]() { return binaryOp([&]() { return readChar(); }, [&]() { return readChar(); }, [&](auto a, auto b) { return a + b; }); }, [&]() { return uint8_t(uint64_t(3)); }, [&](auto a, auto b) { return a < b; }) && binaryOp([&]() { return toSigned(readChar()); }, [&]() { return toSigned(readChar()); }, [&](auto a, auto b) { return a < b; })) {
}
};
}`)
})
Expand Down

0 comments on commit 55fb26b

Please sign in to comment.