1 | ;-*- Mode: Lisp -*- |
---|

2 | ;;;; Author: Paul Dietz |
---|

3 | ;;;; Created: Fri Nov 28 05:14:25 2003 |
---|

4 | ;;;; Contains: Tests of HASH-TABLE-COUNT |
---|

5 | |
---|

6 | (in-package :cl-test) |
---|

7 | |
---|

8 | (deftest hash-table-count.1 |
---|

9 | (hash-table-count (make-hash-table)) |
---|

10 | 0) |
---|

11 | |
---|

12 | (deftest hash-table-count.2 |
---|

13 | (hash-table-count (make-hash-table :test 'eq)) |
---|

14 | 0) |
---|

15 | |
---|

16 | (deftest hash-table-count.3 |
---|

17 | (hash-table-count (make-hash-table :test 'eql)) |
---|

18 | 0) |
---|

19 | |
---|

20 | (deftest hash-table-count.4 |
---|

21 | (hash-table-count (make-hash-table :test 'equal)) |
---|

22 | 0) |
---|

23 | |
---|

24 | (deftest hash-table-count.5 |
---|

25 | (hash-table-count (make-hash-table :test 'equalp)) |
---|

26 | 0) |
---|

27 | |
---|

28 | (deftest hash-table-count.6 |
---|

29 | (hash-table-count (make-hash-table :test #'eq)) |
---|

30 | 0) |
---|

31 | |
---|

32 | (deftest hash-table-count.7 |
---|

33 | (hash-table-count (make-hash-table :test #'eql)) |
---|

34 | 0) |
---|

35 | |
---|

36 | (deftest hash-table-count.8 |
---|

37 | (hash-table-count (make-hash-table :test #'equal)) |
---|

38 | 0) |
---|

39 | |
---|

40 | (deftest hash-table-count.9 |
---|

41 | (hash-table-count (make-hash-table :test #'equalp)) |
---|

42 | 0) |
---|

43 | |
---|

44 | (deftest hash-table-count.10 |
---|

45 | (hash-table-count (let ((table (make-hash-table))) |
---|

46 | (setf (gethash 'x table) 1) |
---|

47 | table)) |
---|

48 | 1) |
---|

49 | |
---|

50 | (deftest hash-table-count.11 |
---|

51 | (let ((table (make-hash-table))) |
---|

52 | (setf (gethash 'x table) 1) |
---|

53 | (values (hash-table-count table) |
---|

54 | (progn |
---|

55 | (remhash 'x table) |
---|

56 | (hash-table-count table)))) |
---|

57 | 1 0) |
---|

58 | |
---|

59 | ;; This function is mostly tested by calls to test-hash-table-1 |
---|

60 | |
---|

61 | (deftest hash-table-count.error.1 |
---|

62 | (signals-error (hash-table-count) program-error) |
---|

63 | t) |
---|

64 | |
---|

65 | (deftest hash-table-count.error.2 |
---|

66 | (signals-error (hash-table-count (make-hash-table) nil) |
---|

67 | program-error) |
---|

68 | t) |
---|