Created
May 12, 2022 17:30
-
-
Save ancientstraits/b1f44e922642e11cc92f90ae7521977c to your computer and use it in GitHub Desktop.
A mocking framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <ctype.h> | |
void mock(char* s) { | |
srand(time(NULL)); | |
for (int i = 0; s[i]; i++) { | |
if (rand() % 2 == 0) | |
s[i] = toupper(s[i]); | |
else | |
s[i] = tolower(s[i]); | |
} | |
} | |
int main() { | |
char str[] = "this is the mock string"; | |
mock(str); | |
printf("%s\n", str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment