fix: fix testing code
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
parent
2d89c5e80f
commit
a6e7b1dfd3
11
test/fuzzy.h
11
test/fuzzy.h
|
@ -4,6 +4,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct fuzzyconfig {
|
||||
int seed;
|
||||
|
@ -29,12 +30,14 @@ void random_clean_string(char* s, int len) {
|
|||
}
|
||||
|
||||
void random_string(char* s, int len) {
|
||||
// len - 1 ensures that we can still set the null byte for the final byte
|
||||
int val;
|
||||
int val = rand();
|
||||
|
||||
for (int i = 0; i < len - 1; i++) {
|
||||
// String can't be an empty string as they aren't supported
|
||||
s[0] = (char)(val % 255 + 1);
|
||||
|
||||
for (int i = 1; i < len - 1; i++) {
|
||||
val = rand();
|
||||
s[i] = ((char *) &val)[0];
|
||||
s[i] = (char)(val % 256);
|
||||
}
|
||||
|
||||
// Just in case no null characters were created
|
||||
|
|
Loading…
Reference in New Issue