testdata.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (C) 2011 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_TESTDATA_H
  15. #define __UTIL_UNITTESTS_TESTDATA_H 1
  16. /**
  17. * @file testdata.h
  18. * @short Manipulating test data files.
  19. *
  20. * This utility defines functions that help test case handle test data
  21. * stored in a file.
  22. */
  23. namespace isc {
  24. namespace util {
  25. namespace unittests {
  26. /// Add a path (directory) that \c openTestData() will search for test data
  27. /// files.
  28. void addTestDataPath(const std::string& path);
  29. /// Open a file specified by 'datafile' using the data paths registered via
  30. /// addTestDataPath(). On success, ifs will be ready for reading the data
  31. /// stored in 'datafile'. If the data file cannot be open with any of the
  32. /// registered paths, a runtime_error exception will be thrown.
  33. void openTestData(const char* const datafile, std::ifstream& ifs);
  34. }
  35. }
  36. }
  37. #endif // __UTIL_UNITTESTS_TESTDATA_H
  38. // Local Variables:
  39. // mode: c++
  40. // End: