C++: Add tests for all dataflow examples that occur in our docs

This commit is contained in:
Jeroen Ketema
2023-02-28 14:27:57 +01:00
parent 484f761c6d
commit 3014f207f3
23 changed files with 285 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
unsigned int ntohl(unsigned int netlong);
void test_ntohl(
unsigned int netlong0, unsigned int netlong1, unsigned int netlong2,
int * arr, unsigned int arr_size) {
unsigned int hostlong0 = ntohl(netlong0);
unsigned int hostlong1 = ntohl(netlong1);
unsigned int hostlong2 = ntohl(netlong2);
int val0 = arr[hostlong0];
if (hostlong1 < arr_size) {
int val1 = arr[hostlong1];
}
for (unsigned int i = 0; i < hostlong2; ++i) {
int val2 = arr[i];
}
}