~ubuntu-branches/ubuntu/jaunty/tablix2/jaunty

« back to all changes in this revision

Viewing changes to ttf/tests/maxconsecutive-1.xml

  • Committer: Bazaar Package Importer
  • Author(s): Robert Lemmen
  • Date: 2007-09-18 15:54:15 UTC
  • mfrom: (1.1.3 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20070918155415-uwkixfe5ub1lee3o
Tags: 0.3.5-1
* New upstream release (closes: #439886)
* fixed build system to make it re-buildable without cleans

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
2
BEGIN TTF BLOCK
 
3
; This test case must result in a pattern like this in the time-ext vector
 
4
 
 
5
; A . A . A . A A . A . A . A A . A . A . A  and so on...
 
6
;              ^-new day starts
 
7
 
 
8
(define days 5)
 
9
(define periods 7)
 
10
 
 
11
; number of defined events
 
12
(define tuplenum 20)
 
13
 
 
14
(define (get-day tupleid) (quotient (get-time tupleid) periods))
 
15
(define (get-period tupleid) (modulo (get-time tupleid) periods))
 
16
 
 
17
; vector similar to time extension
 
18
(define time-ext (make-vector (* days periods) -1))
 
19
 
 
20
(define (<> n1 n2) (not (= n1 n2)))
 
21
 
 
22
; fill in time-ext vector
 
23
(define (update-ext)
 
24
        (let loop ((i 0))
 
25
                (if (< i tuplenum) 
 
26
                        (begin
 
27
                                (vector-set! time-ext (get-time i) i)
 
28
                                (loop (+ i 1)))
 
29
                        #t)))
 
30
 
 
31
(define (check-block start num)
 
32
        (let loop ((i 0) (result #t))
 
33
                (if (< i num) (begin
 
34
                        (if (= (modulo i 2) 0)
 
35
                                (if (= (vector-ref time-ext (+ i start)) -1)
 
36
                                        (define result #f))
 
37
                                (if (<> (vector-ref time-ext (+ i start)) -1)
 
38
                                        (define result #f)))
 
39
                        (loop (+ i 1) result))
 
40
                        result)))
 
41
 
 
42
(test-ttf 
 
43
        (update-ext)
 
44
        (check-block 0 periods)
 
45
        (check-block 7 periods)
 
46
        (check-block 14 periods)
 
47
        (check-block 21 periods)
 
48
        (check-block 28 periods))
 
49
END TTF BLOCK
 
50
-->
 
51
<ttm version="0.2.0">
 
52
        <modules>
 
53
                <module name="sametime" weight="60" mandatory="yes"/> 
 
54
                <module name="timeplace" weight="60" mandatory="yes"/>
 
55
                <module name="maxconsecutive" weight="60" mandatory="yes">
 
56
                        <option name="max-consecutive">1</option>
 
57
                </module>
 
58
        </modules>
 
59
 
 
60
        <resources>
 
61
                <constant>
 
62
                        <resourcetype type="teacher">
 
63
                                <resource name="a"/>
 
64
                        </resourcetype>
 
65
                        <resourcetype type="class">
 
66
                                <resource name="1"/>
 
67
                        </resourcetype>
 
68
                </constant>
 
69
                <variable>
 
70
                        <resourcetype type="room">
 
71
                                <linear name="#" from="1" to="40"/>
 
72
                        </resourcetype>
 
73
                        <resourcetype type="time">
 
74
                                <matrix width="5" height="7"/>
 
75
                        </resourcetype>
 
76
                </variable>
 
77
        </resources>
 
78
 
 
79
        <events>
 
80
                <event name="test-1-a" repeats="20">
 
81
                        <resource type="teacher" name="a"/>
 
82
                        <resource type="class" name="1"/>
 
83
                </event>
 
84
        </events>
 
85
</ttm>