Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include <parserutils/parserutils.h>
  5.  
  6. #include "input/filter.h"
  7.  
  8. #include "testutils.h"
  9.  
  10. static void *myrealloc(void *ptr, size_t len, void *pw)
  11. {
  12.         UNUSED(pw);
  13.  
  14.         return realloc(ptr, len);
  15. }
  16.  
  17. int main(int argc, char **argv)
  18. {
  19.         parserutils_filter *input;
  20.         parserutils_filter_optparams params;
  21.         parserutils_error expected;
  22.  
  23. #ifndef WITHOUT_ICONV_FILTER
  24.         expected = PARSERUTILS_OK;
  25. #else
  26.         expected = PARSERUTILS_BADENCODING;
  27. #endif
  28.  
  29.         UNUSED(argc);
  30.         UNUSED(argv);
  31.  
  32.         assert(parserutils__filter_create("UTF-8", myrealloc, NULL, &input) ==
  33.                         PARSERUTILS_OK);
  34.  
  35.         params.encoding.name = "GBK";
  36.         assert(parserutils__filter_setopt(input,
  37.                         PARSERUTILS_FILTER_SET_ENCODING, &params) ==
  38.                         expected);
  39.  
  40.         params.encoding.name = "GBK";
  41.         assert(parserutils__filter_setopt(input,
  42.                         PARSERUTILS_FILTER_SET_ENCODING, &params) ==
  43.                         expected);
  44.  
  45.         parserutils__filter_destroy(input);
  46.  
  47.         printf("PASS\n");
  48.  
  49.         return 0;
  50. }
  51.