Skip to content

Commit 424bed5

Browse files
author
Enrico Steffinlongo
committed
Add regression tests for byte extraction/update
1 parent 455cf80 commit 424bed5

12 files changed

+134
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint16_t x[3];
7+
x[0] = 0;
8+
x[1] = 0;
9+
x[2] = 0;
10+
uint8_t *c = x;
11+
c[1] = 1;
12+
assert(x[0] == 256);
13+
assert(x[0] == 0);
14+
assert(x[1] == 0);
15+
assert(x[2] == 0);
16+
uint16_t between = c[1];
17+
assert(between == 1);
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
array-misalign-between.c
3+
--slice-formula
4+
\[main\.assertion\.1\] line \d+ assertion x\[0\] == 256: SUCCESS
5+
\[main\.assertion\.2\] line \d+ assertion x\[0\] == 0: FAILURE
6+
\[main\.assertion\.3\] line \d+ assertion x\[1\] == 0: SUCCESS
7+
\[main\.assertion\.4\] line \d+ assertion x\[2\] == 0: SUCCESS
8+
\[main\.assertion\.5\] line \d+ assertion between == 1: SUCCESS
9+
^EXIT=10$
10+
^SIGNAL=0$
11+
--
12+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint16_t x[3];
7+
x[0] = 0;
8+
x[1] = 0;
9+
x[2] = 0;
10+
uint8_t *c = x;
11+
c[1] = 1;
12+
assert(x[0] == 256ul);
13+
assert(x[0] == 0ul);
14+
assert(x[1] == 0ul);
15+
assert(x[2] == 0ul);
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
array-misalign.c
3+
--slice-formula
4+
\[main.assertion\.1\] line \d+ assertion x\[0\] == 256ul: SUCCESS
5+
\[main.assertion\.2\] line \d+ assertion x\[0\] == 0ul: FAILURE
6+
\[main.assertion\.3\] line \d+ assertion x\[1\] == 0ul: SUCCESS
7+
\[main.assertion\.4\] line \d+ assertion x\[2\] == 0ul: SUCCESS
8+
^EXIT=10$
9+
^SIGNAL=0$
10+
--
11+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint8_t x[2];
7+
x[0] = 1u;
8+
x[1] = 1u;
9+
uint16_t *y = x;
10+
uint16_t z = *y;
11+
assert(z == 257);
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
byte-extract-small.c
3+
--slice-formula
4+
\[main.assertion\.1\] line \d+ assertion z == 257: SUCCESS
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint16_t x;
7+
uint8_t *y = &x;
8+
assert(y[0] == 0);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
byte-extract.c
3+
--slice-formula
4+
\[main.assertion\.1\] line \d+ assertion y\[0\] == 0: FAILURE
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint8_t x[2];
7+
x[0] = 0;
8+
x[1] = 0;
9+
uint16_t *y = x;
10+
*y = 258;
11+
assert(x[0] == 2);
12+
assert(x[1] == 1);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
byte-update-small.c
3+
--slice-formula
4+
\[main\.assertion\.1\] line \d+ assertion x\[0\] == 2: SUCCESS
5+
\[main\.assertion\.2\] line \d+ assertion x\[1\] == 1: SUCCESS
6+
^EXIT=0$
7+
^SIGNAL=0$
8+
--
9+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
4+
int main()
5+
{
6+
uint16_t x = 0;
7+
uint8_t *y = &x;
8+
y[1] = 1;
9+
assert(x == 256);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
byte-update.c
3+
--slice-formula
4+
\[main\.assertion\.1\] line \d+ assertion x == 256: SUCCESS
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--

0 commit comments

Comments
 (0)