source: trunk/source/tests/ansi-tests/format-tilde.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Wed Jul 28 00:27:00 2004
4;;;; Contains: Tests of format directive ~~
5
6(in-package :cl-test)
7(compile-and-load "printer-aux.lsp")
8
9(def-format-test format.~.1
10  "~~" nil "~")
11
12(deftest format.~.2
13  (loop for i from 0 to 100
14        for s = (make-string i :initial-element #\~)
15        for format-string = (format nil "~~~D~~" i)
16        for s2 = (format nil format-string)
17        unless (string= s s2)
18        collect (list i s s2))
19  nil)
20
21(deftest formatter.~.2
22  (loop for i from 0 to 100
23        for s = (make-string i :initial-element #\~)
24        for format-string = (format nil "~~~D~~" i)
25        for fn = (eval `(formatter ,format-string))
26        for s2 = (formatter-call-to-string fn)
27        unless (string= s s2)
28        collect (list i s s2))
29  nil)
30
31(def-format-test format.~.3
32  "~v~" (0) "")
33
34(deftest format.~.4
35  (loop for i from 0 to 100
36        for s = (make-string i :initial-element #\~)
37        for s2 = (format nil "~V~" i)
38        unless (string= s s2)
39        collect (list i s s2))
40  nil)
41
42(deftest formatter.~.4
43  (let ((fn (formatter "~v~")))
44    (loop for i from 0 to 100
45          for s = (make-string i :initial-element #\~)
46          for s2 = (formatter-call-to-string fn i)
47          unless (string= s s2)
48          collect (list i s s2)))
49  nil)
50
51(deftest format.~.5
52  (loop for i from 0 to (min (- call-arguments-limit 3) 100)
53        for s = (make-string i :initial-element #\~)
54        for args = (make-list i)
55        for s2 = (apply #'format nil "~#~" args)
56        unless (string= s s2)
57        collect (list i s s2))
58  nil)
59
60(deftest formatter.~.5
61  (let ((fn (formatter "~#~")))
62    (loop for i from 0 to (min (- call-arguments-limit 3) 100)
63          for s = (make-string i :initial-element #\~)
64          for args = (make-list i)
65          for s2 = (with-output-to-string
66                     (stream)
67                     (assert (equal (apply fn stream args) args)))
68          unless (string= s s2)
69          collect (list i s s2)))
70  nil)
Note: See TracBrowser for help on using the repository browser.