(root)/
xz-5.4.5/
tests/
tests.h
       1  ///////////////////////////////////////////////////////////////////////////////
       2  //
       3  /// \file       tests.h
       4  /// \brief      Common definitions for test applications
       5  //
       6  //  Author:     Lasse Collin
       7  //
       8  //  This file has been put into the public domain.
       9  //  You can do whatever you want with this file.
      10  //
      11  ///////////////////////////////////////////////////////////////////////////////
      12  
      13  #ifndef LZMA_TESTS_H
      14  #define LZMA_TESTS_H
      15  
      16  #include "sysdefs.h"
      17  #include "tuklib_integer.h"
      18  #include "lzma.h"
      19  #include "tuktest.h"
      20  
      21  
      22  // Invalid value for the lzma_check enumeration. This must be positive
      23  // but small enough to fit into signed char since the underlying type might
      24  // one some platform be a signed char.
      25  //
      26  // Don't put LZMA_ at the beginning of the name so that it is obvious that
      27  // this constant doesn't come from the API headers.
      28  #define INVALID_LZMA_CHECK_ID ((lzma_check)(LZMA_CHECK_ID_MAX + 1))
      29  
      30  
      31  // This table and macro allow getting more readable error messages when
      32  // comparing the lzma_ret enumeration values.
      33  static const char enum_strings_lzma_ret[][24] = {
      34  	"LZMA_OK",
      35  	"LZMA_STREAM_END",
      36  	"LZMA_NO_CHECK",
      37  	"LZMA_UNSUPPORTED_CHECK",
      38  	"LZMA_GET_CHECK",
      39  	"LZMA_MEM_ERROR",
      40  	"LZMA_MEMLIMIT_ERROR",
      41  	"LZMA_FORMAT_ERROR",
      42  	"LZMA_OPTIONS_ERROR",
      43  	"LZMA_DATA_ERROR",
      44  	"LZMA_BUF_ERROR",
      45  	"LZMA_PROG_ERROR",
      46  	"LZMA_SEEK_NEEDED",
      47  };
      48  
      49  #define assert_lzma_ret(test_expr, ref_val) \
      50  	assert_enum_eq(test_expr, ref_val, enum_strings_lzma_ret)
      51  
      52  
      53  static const char enum_strings_lzma_check[][24] = {
      54  	"LZMA_CHECK_NONE",
      55  	"LZMA_CHECK_CRC32",
      56  	"LZMA_CHECK_UNKNOWN_2",
      57  	"LZMA_CHECK_UNKNOWN_3",
      58  	"LZMA_CHECK_CRC64",
      59  	"LZMA_CHECK_UNKNOWN_5",
      60  	"LZMA_CHECK_UNKNOWN_6",
      61  	"LZMA_CHECK_UNKNOWN_7",
      62  	"LZMA_CHECK_UNKNOWN_8",
      63  	"LZMA_CHECK_UNKNOWN_9",
      64  	"LZMA_CHECK_SHA256",
      65  	"LZMA_CHECK_UNKNOWN_11",
      66  	"LZMA_CHECK_UNKNOWN_12",
      67  	"LZMA_CHECK_UNKNOWN_13",
      68  	"LZMA_CHECK_UNKNOWN_14",
      69  	"LZMA_CHECK_UNKNOWN_15",
      70  };
      71  
      72  #define assert_lzma_check(test_expr, ref_val) \
      73  	assert_enum_eq(test_expr, ref_val, enum_strings_lzma_check)
      74  
      75  #endif