Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.1 KiB

  1. /* Test driver for class HashTable */
  2. /* Author: Paul Larson, [email protected] */
  3. /* Much hacked upon by George V. Reilly, [email protected] */
  4. #include <windows.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include "numset.h"
  9. LK_RETCODE
  10. InsertRecord(
  11. CNumberTestHashTable* pntht,
  12. int n)
  13. {
  14. return pntht->InsertRecord((const int*) (DWORD_PTR) n);
  15. }
  16. LK_RETCODE
  17. FindKey(
  18. CNumberTestHashTable* pntht,
  19. int nKey,
  20. int** pptOut)
  21. {
  22. return pntht->FindKey(nKey, pptOut);
  23. }
  24. LK_RETCODE
  25. DeleteKey(
  26. CNumberTestHashTable* pntht,
  27. int nKey)
  28. {
  29. return pntht->DeleteKey(nKey);
  30. }
  31. void Test(
  32. CNumberTestHashTable* pntht,
  33. int n)
  34. {
  35. int* pt2 = NULL;
  36. IRTLVERIFY(LK_SUCCESS == InsertRecord(pntht, n));
  37. IRTLVERIFY(LK_SUCCESS == FindKey(pntht, n, &pt2));
  38. printf("FK = %d\n", (int) (DWORD_PTR) pt2);
  39. IRTLVERIFY(LK_SUCCESS == DeleteKey(pntht, n));
  40. }
  41. int __cdecl
  42. main(
  43. int argc,
  44. char **argv)
  45. {
  46. CNumberTestHashTable ntht;
  47. int n = 1965;
  48. Test(&ntht, n);
  49. return(0) ;
  50. } /* main */