Skip to content

Instantly share code, notes, and snippets.

@orumin
Created November 11, 2020 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orumin/4d270d628903b37b47a57cc11cff9d45 to your computer and use it in GitHub Desktop.
Save orumin/4d270d628903b37b47a57cc11cff9d45 to your computer and use it in GitHub Desktop.
coverage test
#include <stdio.h>
#include <stdlib.h>
void usage(char *cmd)
{
fprintf(stderr, "%s: you need to pass arguments at least 1\n", cmd);
return;
}
int main(int argc, char **argv)
{
if (argc < 2) {
usage(argv[0]);
exit(EXIT_FAILURE);
}
switch (argc) {
case 2:
printf("you passed 1 argument\n");
break;
case 3:
printf("you passed 2 arguments\n");
break;
default:
printf("you passed more than 3 arguments\n");
break;
}
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment