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

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

3 | ;;;; Created: Tue Jan 21 22:01:09 2003 |
---|

4 | ;;;; Contains: Tests of ARRAY-TOTAL-SIZE |
---|

5 | |
---|

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

7 | |
---|

8 | ;;; More tests of ARRAY-TOTAL-SIZE are in make-array.lsp |
---|

9 | |
---|

10 | (deftest array-total-size.1 |
---|

11 | (array-total-size #0aNIL) |
---|

12 | 1) |
---|

13 | |
---|

14 | (deftest array-total-size.2 |
---|

15 | (array-total-size "abcdef") |
---|

16 | 6) |
---|

17 | |
---|

18 | (deftest array-total-size.3 |
---|

19 | (array-total-size #(a b c)) |
---|

20 | 3) |
---|

21 | |
---|

22 | (deftest array-total-size.4 |
---|

23 | (array-total-size #*0011010) |
---|

24 | 7) |
---|

25 | |
---|

26 | (deftest array-total-size.5 |
---|

27 | (array-total-size #2a((1 2 3)(4 5 6)(7 8 9)(a b c))) |
---|

28 | 12) |
---|

29 | |
---|

30 | (deftest array-total-size.6 |
---|

31 | (macrolet ((%m (z) z)) |
---|

32 | (array-total-size (expand-in-current-env (%m #(a b c))))) |
---|

33 | 3) |
---|

34 | |
---|

35 | (deftest array-total-size.order.1 |
---|

36 | (let ((i 0) a) |
---|

37 | (values |
---|

38 | (array-total-size (progn (setf a (incf i)) #(a b c d))) |
---|

39 | i a)) |
---|

40 | 4 1 1) |
---|

41 | |
---|

42 | ;;; Error tests |
---|

43 | |
---|

44 | (deftest array-total-size.error.1 |
---|

45 | (signals-error (array-total-size) program-error) |
---|

46 | t) |
---|

47 | |
---|

48 | (deftest array-total-size.error.2 |
---|

49 | (signals-error (array-total-size #(a b c) nil) program-error) |
---|

50 | t) |
---|

51 | |
---|

52 | (deftest array-total-size.error.3 |
---|

53 | (check-type-error #'array-total-size #'arrayp) |
---|

54 | nil) |
---|

55 | |
---|

56 | (deftest array-total-size.error.4 |
---|

57 | (signals-error (array-total-size 0) type-error) |
---|

58 | t) |
---|

59 | |
---|

60 | (deftest array-total-size.error.5 |
---|

61 | (signals-type-error x 0 (locally (array-total-size x) t)) |
---|

62 | t) |
---|

63 | |
---|