From bd48e2ed04c59d9f9b1796b58744edaa810d4d66 Mon Sep 17 00:00:00 2001 From: "Vladimir Gladkov (office-win10)" Date: Wed, 20 Nov 2024 14:03:38 +0800 Subject: [PATCH] [test] add test154.jnc, test154.jnc for the bw-or & bw-xor on bitflag enums --- test/jnc/test154.jnc | 24 ++++++++++++++++++++++++ test/jnc/test155.jnc | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/jnc/test154.jnc create mode 100644 test/jnc/test155.jnc diff --git a/test/jnc/test154.jnc b/test/jnc/test154.jnc new file mode 100644 index 000000000..869263400 --- /dev/null +++ b/test/jnc/test154.jnc @@ -0,0 +1,24 @@ +// this test was used when debugging the bitflag enum bw-or & bw-xor issue + +//.............................................................................. + +SerialTapProStatusLines g_lines = 0; + +int main() { + uint8_t c = (SerialTapProStatusLines)0x12; + SerialTapProStatusLines lines = (SerialTapProStatusLines)c; + uint8_t mask = lines ^ g_lines; + printf("lines: 0x%x, mask: 0x%x\n", lines, mask); + assert(lines == 0x12 && mask == 0x12); + g_lines = lines; + return 0; +} + +bitflag enum SerialTapProStatusLines: int8_t { + Cts, + Dsr, + Ring, + Dcd, + Rts, + Dtr, +} diff --git a/test/jnc/test155.jnc b/test/jnc/test155.jnc new file mode 100644 index 000000000..b7f2b6f1d --- /dev/null +++ b/test/jnc/test155.jnc @@ -0,0 +1,24 @@ +// this test was used when debugging the bitflag enum bw-or & bw-xor issue + +//.............................................................................. + +SerialTapProStatusLines g_lines = 0; + +int main() { + uint8_t c = (SerialTapProStatusLines)0x12; + SerialTapProStatusLines lines = (SerialTapProStatusLines)c; + uint8_t mask = lines ^ g_lines; + printf("lines: 0x%x, mask: 0x%x\n", lines, mask); + assert(lines == 0x12 && mask == 0x12); + g_lines = lines; + return 0; +} + +bitflag enum SerialTapProStatusLines: uint8_t { + Cts, + Dsr, + Ring, + Dcd, + Rts, + Dtr, +}