wiredata.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef __UTIL_UNITTESTS_WIREDATA_H
  15. #define __UTIL_UNITTESTS_WIREDATA_H 1
  16. #include <cstddef>
  17. /// \file wiredata.h
  18. /// \brief Utilities for tests with wire data.
  19. ///
  20. /// This utility provides convenient helper functions for unit tests using
  21. /// wire (binary) data.
  22. namespace isc {
  23. namespace util {
  24. namespace unittests {
  25. /// \brief Compare two sets of binary data in a google test.
  26. ///
  27. /// This method checks if the expected and actual data have the same length
  28. /// and all bytes are the same. If not, it reports the point of mismatch in
  29. /// the google test format.
  30. void matchWireData(const void* expected_data, std::size_t expected_len,
  31. const void* actual_data, std::size_t actual_len);
  32. }
  33. }
  34. }
  35. #endif // __UTIL_UNITTESTS_WIREDATA_H
  36. // Local Variables:
  37. // mode: c++
  38. // End: