test/automated/testsdl.c
branchgsoc2009_unit_tests
changeset 3756 427f059bc814
parent 3753 5b48a529fd8a
equal deleted inserted replaced
3755:e04d9c69a6fd 3756:427f059bc814
    12 
    12 
    13 #include "platform/platform.h"
    13 #include "platform/platform.h"
    14 #include "rwops/rwops.h"
    14 #include "rwops/rwops.h"
    15 #include "surface/surface.h"
    15 #include "surface/surface.h"
    16 #include "render/render.h"
    16 #include "render/render.h"
       
    17 #include "audio/audio.h"
    17 
    18 
    18 #include <stdio.h> /* printf */
    19 #include <stdio.h> /* printf */
    19 #include <stdlib.h> /* exit */
    20 #include <stdlib.h> /* exit */
    20 #include <unistd.h> /* getopt */
    21 #include <unistd.h> /* getopt */
    21 #include <getopt.h> /* getopt_long */
    22 #include <getopt.h> /* getopt_long */
    30 /* Automatic. */
    31 /* Automatic. */
    31 static int run_platform    = 1; /**< Run platform tests. */
    32 static int run_platform    = 1; /**< Run platform tests. */
    32 static int run_rwops       = 1; /**< Run RWops tests. */
    33 static int run_rwops       = 1; /**< Run RWops tests. */
    33 static int run_surface     = 1; /**< Run surface tests. */
    34 static int run_surface     = 1; /**< Run surface tests. */
    34 static int run_render      = 1; /**< Run render tests. */
    35 static int run_render      = 1; /**< Run render tests. */
       
    36 static int run_audio       = 1; /**< Run audio tests. */
    35 
    37 
    36 /*
    38 /*
    37  * Prototypes.
    39  * Prototypes.
    38  */
    40  */
    39 static void print_usage( const char *name );
    41 static void print_usage( const char *name );
    50    printf("   -m, --manual    enables tests that require user interaction\n");
    52    printf("   -m, --manual    enables tests that require user interaction\n");
    51    printf("   --noplatform    do not run the platform tests\n");
    53    printf("   --noplatform    do not run the platform tests\n");
    52    printf("   --norwops       do not run the rwops tests\n");
    54    printf("   --norwops       do not run the rwops tests\n");
    53    printf("   --nosurface     do not run the surface tests\n");
    55    printf("   --nosurface     do not run the surface tests\n");
    54    printf("   --norender      do not run the render tests\n");
    56    printf("   --norender      do not run the render tests\n");
       
    57    printf("   --noaudio       do not run the audio tests\n");
    55    printf("   -v, --verbose   increases verbosity level by 1 for each -v\n");
    58    printf("   -v, --verbose   increases verbosity level by 1 for each -v\n");
    56    printf("   -q, --quiet     only displays errors\n");
    59    printf("   -q, --quiet     only displays errors\n");
    57    printf("   -h, --help      display this message and exit\n");
    60    printf("   -h, --help      display this message and exit\n");
    58 }
    61 }
    59 
    62 
    67       { "manual", no_argument, 0, 'm' },
    70       { "manual", no_argument, 0, 'm' },
    68       { "noplatform", no_argument, 0, 0 },
    71       { "noplatform", no_argument, 0, 0 },
    69       { "norwops", no_argument, 0, 0 },
    72       { "norwops", no_argument, 0, 0 },
    70       { "nosurface", no_argument, 0, 0 },
    73       { "nosurface", no_argument, 0, 0 },
    71       { "norender", no_argument, 0, 0 },
    74       { "norender", no_argument, 0, 0 },
       
    75       { "noaudio", no_argument, 0, 0 },
    72       { "verbose", no_argument, 0, 'v' },
    76       { "verbose", no_argument, 0, 'v' },
    73       { "quiet", no_argument, 0, 'q' },
    77       { "quiet", no_argument, 0, 'q' },
    74       { "help", no_argument, 0, 'h' },
    78       { "help", no_argument, 0, 'h' },
    75       {NULL,0,0,0}
    79       {NULL,0,0,0}
    76    };
    80    };
    94                run_rwops = 0;
    98                run_rwops = 0;
    95             else if (strcmp(str,"nosurface")==0)
    99             else if (strcmp(str,"nosurface")==0)
    96                run_surface = 0;
   100                run_surface = 0;
    97             else if (strcmp(str,"norender")==0)
   101             else if (strcmp(str,"norender")==0)
    98                run_render = 0;
   102                run_render = 0;
       
   103             else if (strcmp(str,"noaudio")==0)
       
   104                run_audio = 0;
    99             break;
   105             break;
   100 
   106 
   101          /* Manual. */
   107          /* Manual. */
   102          case 'm':
   108          case 'm':
   103             run_manual = 1;
   109             run_manual = 1;
   152       failed += test_rwops();
   158       failed += test_rwops();
   153    if (run_surface)
   159    if (run_surface)
   154       failed += test_surface();
   160       failed += test_surface();
   155    if (run_render)
   161    if (run_render)
   156       failed += test_render();
   162       failed += test_render();
       
   163    if (run_audio)
       
   164       failed += test_audio();
   157 
   165 
   158    /* Manual tests. */
   166    /* Manual tests. */
   159    if (run_manual) {
   167    if (run_manual) {
   160    }
   168    }
   161 
   169