1 /******************************************************************** 2 * * 3 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. * 4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 * * 8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 * 9 * by the Xiph.Org Foundation http://www.xiph.org/ * 10 * * 11 ******************************************************************** 12 13 function: routines for validating codec initialization 14 last mod: $Id: noop.c 16503 2009-08-22 18:14:02Z giles $ 15 16 ********************************************************************/ 17 18 #include <theora/theoraenc.h> 19 #include <theora/theoradec.h> 20 21 #include "tests.h" 22 23 static int noop_test_info()24noop_test_info () 25 { 26 th_info ti; 27 28 INFO ("+ Initializing th_info struct"); 29 th_info_init (&ti); 30 31 INFO ("+ Clearing empty th_info struct"); 32 th_info_clear (&ti); 33 34 return 0; 35 } 36 37 static int noop_test_comments()38noop_test_comments () 39 { 40 th_comment tc; 41 42 INFO ("+ Initializing th_comment struct"); 43 th_comment_init (&tc); 44 45 INFO ("+ Clearing empty th_comment struct") 46 th_comment_clear (&tc); 47 48 return 0; 49 } 50 51 static int noop_test_encode()52noop_test_encode () 53 { 54 th_info ti; 55 th_enc_ctx *te; 56 57 INFO ("+ Initializing th_info struct"); 58 th_info_init (&ti); 59 60 INFO ("+ Testing encoder context with empty th_info"); 61 te = th_encode_alloc(&ti); 62 if (te != NULL) 63 FAIL("td_encode_alloc accepted an unconfigured th_info"); 64 65 INFO ("+ Setting 16x16 image size"); 66 ti.frame_width = 16; 67 ti.frame_height = 16; 68 69 INFO ("+ Allocating encoder context"); 70 te = th_encode_alloc(&ti); 71 if (te == NULL) 72 FAIL("td_encode_alloc returned a null pointer"); 73 74 INFO ("+ Clearing th_info struct"); 75 th_info_clear (&ti); 76 77 INFO ("+ Freeing encoder context"); 78 th_encode_free(te); 79 80 return 0; 81 } 82 83 static int noop_test_decode()84noop_test_decode () 85 { 86 th_info ti; 87 th_dec_ctx *td; 88 89 INFO ("+ Testing decoder context with null info and setup"); 90 td = th_decode_alloc(NULL, NULL); 91 if (td != NULL) 92 FAIL("td_decode_alloc accepted null info pointers"); 93 94 INFO ("+ Initializing th_info struct"); 95 th_info_init (&ti); 96 97 INFO ("+ Testing decoder context with empty info and null setup"); 98 td = th_decode_alloc(&ti, NULL); 99 if (td != NULL) 100 FAIL("td_decode_alloc accepted null info pointers"); 101 102 INFO ("+ Clearing th_info struct"); 103 th_info_clear (&ti); 104 105 return 0; 106 } 107 main(int argc,char * argv[])108int main(int argc, char *argv[]) 109 { 110 noop_test_info (); 111 112 noop_test_comments (); 113 114 noop_test_encode (); 115 116 noop_test_decode (); 117 118 exit (0); 119 } 120