noop.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. function: routines for validating codec initialization
  13. last mod: $Id$
  14. ********************************************************************/
  15. #include <theora/theoraenc.h>
  16. #include <theora/theoradec.h>
  17. #include "tests.h"
  18. static int
  19. noop_test_info ()
  20. {
  21. th_info ti;
  22. INFO ("+ Initializing th_info struct");
  23. th_info_init (&ti);
  24. INFO ("+ Clearing empty th_info struct");
  25. th_info_clear (&ti);
  26. return 0;
  27. }
  28. static int
  29. noop_test_comments ()
  30. {
  31. th_comment tc;
  32. INFO ("+ Initializing th_comment struct");
  33. th_comment_init (&tc);
  34. INFO ("+ Clearing empty th_comment struct")
  35. th_comment_clear (&tc);
  36. return 0;
  37. }
  38. static int
  39. noop_test_encode ()
  40. {
  41. th_info ti;
  42. th_enc_ctx *te;
  43. INFO ("+ Initializing th_info struct");
  44. th_info_init (&ti);
  45. INFO ("+ Testing encoder context with empty th_info");
  46. te = th_encode_alloc(&ti);
  47. if (te != NULL)
  48. FAIL("td_encode_alloc accepted an unconfigured th_info");
  49. INFO ("+ Setting 16x16 image size");
  50. ti.frame_width = 16;
  51. ti.frame_height = 16;
  52. INFO ("+ Setting a 1:1 frame rate");
  53. ti.fps_numerator = 1;
  54. ti.fps_denominator = 1;
  55. INFO ("+ Allocating encoder context");
  56. te = th_encode_alloc(&ti);
  57. if (te == NULL)
  58. FAIL("td_encode_alloc returned a null pointer");
  59. INFO ("+ Clearing th_info struct");
  60. th_info_clear (&ti);
  61. INFO ("+ Freeing encoder context");
  62. th_encode_free(te);
  63. return 0;
  64. }
  65. static int
  66. noop_test_decode ()
  67. {
  68. th_info ti;
  69. th_dec_ctx *td;
  70. INFO ("+ Testing decoder context with null info and setup");
  71. td = th_decode_alloc(NULL, NULL);
  72. if (td != NULL)
  73. FAIL("td_decode_alloc accepted null info pointers");
  74. INFO ("+ Initializing th_info struct");
  75. th_info_init (&ti);
  76. INFO ("+ Testing decoder context with empty info and null setup");
  77. td = th_decode_alloc(&ti, NULL);
  78. if (td != NULL)
  79. FAIL("td_decode_alloc accepted null info pointers");
  80. INFO ("+ Clearing th_info struct");
  81. th_info_clear (&ti);
  82. return 0;
  83. }
  84. int main(int argc, char *argv[])
  85. {
  86. noop_test_info ();
  87. noop_test_comments ();
  88. noop_test_encode ();
  89. noop_test_decode ();
  90. exit (0);
  91. }