diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 22:18:45 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 22:18:45 +0100 |
| commit | e0f38c7e42d9e48ac654f9dcedf8722ff1136106 (patch) | |
| tree | fc92f1dc8d0ade82541d216e05ba37b3ddc97ca3 /test/010_math_permsign | |
| parent | ad9bdca9741b5f038610cbe0536131ab0dc7b511 (diff) | |
| download | nissy-core-e0f38c7e42d9e48ac654f9dcedf8722ff1136106.tar.gz nissy-core-e0f38c7e42d9e48ac654f9dcedf8722ff1136106.zip | |
Renamed tests, added tests for permsign
Diffstat (limited to 'test/010_math_permsign')
| -rw-r--r-- | test/010_math_permsign/00_solved.in | 8 | ||||
| -rw-r--r-- | test/010_math_permsign/00_solved.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/01_3cycle.in | 6 | ||||
| -rw-r--r-- | test/010_math_permsign/01_3cycle.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/02_22swap.in | 13 | ||||
| -rw-r--r-- | test/010_math_permsign/02_22swap.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/03_singleswap.in | 7 | ||||
| -rw-r--r-- | test/010_math_permsign/03_singleswap.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/04_5ycle.in | 11 | ||||
| -rw-r--r-- | test/010_math_permsign/04_5ycle.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/05_6ycle.in | 9 | ||||
| -rw-r--r-- | test/010_math_permsign/05_6ycle.out | 1 | ||||
| -rw-r--r-- | test/010_math_permsign/permsgn_tests.c | 22 |
13 files changed, 82 insertions, 0 deletions
diff --git a/test/010_math_permsign/00_solved.in b/test/010_math_permsign/00_solved.in new file mode 100644 index 0000000..54b5db0 --- /dev/null +++ b/test/010_math_permsign/00_solved.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | 7 | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | 2 | ||
| 5 | 3 | ||
| 6 | 4 | ||
| 7 | 5 | ||
| 8 | 6 | ||
diff --git a/test/010_math_permsign/00_solved.out b/test/010_math_permsign/00_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permsign/00_solved.out | |||
| @@ -0,0 +1 @@ | |||
| 0 | |||
diff --git a/test/010_math_permsign/01_3cycle.in b/test/010_math_permsign/01_3cycle.in new file mode 100644 index 0000000..bfabfd6 --- /dev/null +++ b/test/010_math_permsign/01_3cycle.in | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | 5 | ||
| 2 | 0 | ||
| 3 | 4 | ||
| 4 | 1 | ||
| 5 | 3 | ||
| 6 | 2 | ||
diff --git a/test/010_math_permsign/01_3cycle.out b/test/010_math_permsign/01_3cycle.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permsign/01_3cycle.out | |||
| @@ -0,0 +1 @@ | |||
| 0 | |||
diff --git a/test/010_math_permsign/02_22swap.in b/test/010_math_permsign/02_22swap.in new file mode 100644 index 0000000..d0b0921 --- /dev/null +++ b/test/010_math_permsign/02_22swap.in | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | 12 | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | 8 | ||
| 5 | 3 | ||
| 6 | 5 | ||
| 7 | 4 | ||
| 8 | 6 | ||
| 9 | 7 | ||
| 10 | 2 | ||
| 11 | 9 | ||
| 12 | 10 | ||
| 13 | 11 | ||
diff --git a/test/010_math_permsign/02_22swap.out b/test/010_math_permsign/02_22swap.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permsign/02_22swap.out | |||
| @@ -0,0 +1 @@ | |||
| 0 | |||
diff --git a/test/010_math_permsign/03_singleswap.in b/test/010_math_permsign/03_singleswap.in new file mode 100644 index 0000000..42a584b --- /dev/null +++ b/test/010_math_permsign/03_singleswap.in | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | 6 | ||
| 2 | 4 | ||
| 3 | 1 | ||
| 4 | 2 | ||
| 5 | 3 | ||
| 6 | 0 | ||
| 7 | 5 | ||
diff --git a/test/010_math_permsign/03_singleswap.out b/test/010_math_permsign/03_singleswap.out new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/010_math_permsign/03_singleswap.out | |||
| @@ -0,0 +1 @@ | |||
| 1 | |||
diff --git a/test/010_math_permsign/04_5ycle.in b/test/010_math_permsign/04_5ycle.in new file mode 100644 index 0000000..630f6fa --- /dev/null +++ b/test/010_math_permsign/04_5ycle.in | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | 10 | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | 6 | ||
| 5 | 2 | ||
| 6 | 3 | ||
| 7 | 4 | ||
| 8 | 5 | ||
| 9 | 7 | ||
| 10 | 8 | ||
| 11 | 9 | ||
diff --git a/test/010_math_permsign/04_5ycle.out b/test/010_math_permsign/04_5ycle.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permsign/04_5ycle.out | |||
| @@ -0,0 +1 @@ | |||
| 0 | |||
diff --git a/test/010_math_permsign/05_6ycle.in b/test/010_math_permsign/05_6ycle.in new file mode 100644 index 0000000..a226bae --- /dev/null +++ b/test/010_math_permsign/05_6ycle.in | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | 8 | ||
| 2 | 6 | ||
| 3 | 0 | ||
| 4 | 1 | ||
| 5 | 3 | ||
| 6 | 2 | ||
| 7 | 4 | ||
| 8 | 5 | ||
| 9 | 7 | ||
diff --git a/test/010_math_permsign/05_6ycle.out b/test/010_math_permsign/05_6ycle.out new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/010_math_permsign/05_6ycle.out | |||
| @@ -0,0 +1 @@ | |||
| 1 | |||
diff --git a/test/010_math_permsign/permsgn_tests.c b/test/010_math_permsign/permsgn_tests.c new file mode 100644 index 0000000..dca9e6e --- /dev/null +++ b/test/010_math_permsign/permsgn_tests.c | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | int permsign(uint8_t *, int); | ||
| 4 | |||
| 5 | int main() { | ||
| 6 | char str[STRLENMAX]; | ||
| 7 | uint8_t a[100]; | ||
| 8 | int n, i, p; | ||
| 9 | |||
| 10 | fgets(str, STRLENMAX, stdin); | ||
| 11 | n = atoi(str); | ||
| 12 | |||
| 13 | for (i = 0; i < n; i++) { | ||
| 14 | fgets(str, STRLENMAX, stdin); | ||
| 15 | a[i] = atoi(str); | ||
| 16 | } | ||
| 17 | |||
| 18 | p = permsign(a, n); | ||
| 19 | printf("%d\n", p); | ||
| 20 | |||
| 21 | return 0; | ||
| 22 | } | ||
