author | HG Automerge |
Thu, 24 Nov 2016 21:56:31 +0000 | |
branch | jv |
changeset 1015 | 7b6393ea3d52 |
parent 804 | 06ccfdcc56d5 |
child 1121 | c5661215109c |
permissions | -rw-r--r-- |
18 | 1 |
"{ Package: 'stx:goodies/monticello/test' }" |
2 |
||
3 |
TestCase subclass:#MCDependencySorterTest |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
804
06ccfdcc56d5
Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
7 |
category:'SCM-Monticello-Tests' |
18 | 8 |
! |
9 |
||
10 |
||
11 |
!MCDependencySorterTest methodsFor:'asserting'! |
|
12 |
||
13 |
assertItems: anArray orderAs: depOrder withRequired: missingDeps toLoad: unloadableItems |
|
14 |
self assertItems: anArray orderAs: depOrder withRequired: missingDeps toLoad: unloadableItems extraProvisions: #() |
|
15 |
! |
|
16 |
||
17 |
assertItems: anArray orderAs: depOrder withRequired: missingDeps toLoad: unloadableItems extraProvisions: provisions |
|
18 |
| order sorter items missing unloadable | |
|
19 |
items _ anArray collect: [:ea | self itemWithSpec: ea]. |
|
20 |
sorter _ MCDependencySorter items: items. |
|
21 |
sorter addExternalProvisions: provisions. |
|
22 |
order _ (sorter orderedItems collect: [:ea | ea name]) asArray. |
|
23 |
self assert: order = depOrder. |
|
24 |
missing _ sorter externalRequirements. |
|
25 |
self assert: missing asSet = missingDeps asSet. |
|
26 |
unloadable _ (sorter itemsWithMissingRequirements collect: [:ea | ea name]) asArray. |
|
27 |
self assert: unloadable asSet = unloadableItems asSet |
|
28 |
! ! |
|
29 |
||
30 |
!MCDependencySorterTest methodsFor:'building'! |
|
31 |
||
32 |
itemWithSpec: anArray |
|
33 |
^ MCMockDependentItem new |
|
34 |
name: anArray first; |
|
35 |
provides: anArray second; |
|
36 |
requires: anArray third |
|
37 |
! ! |
|
38 |
||
39 |
!MCDependencySorterTest methodsFor:'tests'! |
|
40 |
||
41 |
testCascadingUnresolved |
|
42 |
self assertItems: #( |
|
43 |
(a (x) (z)) |
|
44 |
(b () (x)) |
|
45 |
(c () ())) |
|
46 |
orderAs: #(c) |
|
47 |
withRequired: #(z) |
|
48 |
toLoad: #(a b) |
|
49 |
! |
|
50 |
||
51 |
testCycle |
|
52 |
self assertItems: #( |
|
53 |
(a (x) (y)) |
|
54 |
(b (y) (x))) |
|
55 |
orderAs: #() |
|
56 |
withRequired: #() |
|
57 |
toLoad: #(a b) |
|
58 |
! |
|
59 |
||
60 |
testExtraProvisions |
|
61 |
self assertItems: |
|
62 |
#((a (x) (z)) |
|
63 |
(b () (x))) |
|
64 |
orderAs: #(a b) |
|
65 |
withRequired: #() |
|
66 |
toLoad: #() |
|
67 |
extraProvisions: #(x z) |
|
68 |
! |
|
69 |
||
70 |
testMultiRequirementOrdering |
|
71 |
self assertItems: #( |
|
72 |
(a (x) (z)) |
|
73 |
(b (y) ()) |
|
74 |
(c (z) ()) |
|
75 |
(d () (x y z))) |
|
76 |
orderAs: #(b c a d) |
|
77 |
withRequired: #() |
|
78 |
toLoad: #() |
|
79 |
! |
|
80 |
||
81 |
testSimpleOrdering |
|
82 |
self assertItems: #((a (x) ()) |
|
83 |
(c () (y)) |
|
84 |
(b (y) (x))) |
|
85 |
orderAs: #(a b c) |
|
86 |
withRequired: #() |
|
87 |
toLoad: #() |
|
88 |
! |
|
89 |
||
90 |
testSimpleUnresolved |
|
91 |
self assertItems: #( |
|
92 |
(a () (z))) |
|
93 |
orderAs: #() |
|
94 |
withRequired: #(z) |
|
95 |
toLoad: #(a) |
|
96 |
||
97 |
! |
|
98 |
||
99 |
testUnusedAlternateProvider |
|
100 |
self assertItems: #( |
|
101 |
(a (x) (z)) |
|
102 |
(b () (x)) |
|
103 |
(c (x) ())) |
|
104 |
orderAs: #(c b) |
|
105 |
withRequired: #(z) |
|
106 |
toLoad: #(a) |
|
107 |
! ! |
|
108 |
||
109 |
!MCDependencySorterTest class methodsFor:'documentation'! |
|
110 |
||
111 |
version |
|
804
06ccfdcc56d5
Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
112 |
^ '$Header: /cvs/stx/stx/goodies/monticello/test/MCDependencySorterTest.st,v 1.2 2013-05-29 00:00:09 vrany Exp $' |
18 | 113 |
! ! |
804
06ccfdcc56d5
Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
114 |