-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSAMPLES
249 lines (242 loc) · 14.1 KB
/
SAMPLES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
Erlunit 0.2.8.2/alpha - SAMPLES
Read about samples in sample.erl. It is written to be read top down.
Below, you find the results you should get from executing it then:
$ ./test
- or -
$ erl
1> c(erlunit).
2> c(sample).
3> sample:run().
***************************************************************************
ALL SAMPLES
***************************************************************************
***************************************************************************
Super simple demonstration #1 - imperative style.
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Equality check
erlunit: | --> 1 as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Default Suite: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 1, Passed: 1, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Super simple demonstration #2 - message passing style.
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Equality check
erlunit: | --> 1 as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Default Suite: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 1, Passed: 1, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Super simple demonstration #3 - suites.
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 100 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> a /= b as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #1: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #2: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 2, Passed: 2, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Super simple demonstration #4 - concurrent suites.
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 100 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 2 as it should.
erlunit: + ok | Suite #3: Non-Equality check
erlunit: | --> [65] /= 3 as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #1: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #2: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #3: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 3, Passed: 3, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Simple demonstration of test functions: parallel with suites.
***************************************************************************
erlunit: Suites will run concurrently and their output will *interleave*!
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Suite #1: Check for true
erlunit: | --> evaluates to true.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 2 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 3 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 3 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 4 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 4 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 5 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 5 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 6 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 6 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 7 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 7 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 8 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 8 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 9 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 9 as it should.
erlunit: + ok | Suite #1: Equality check
erlunit: | --> 10 as it should.
erlunit: + ok | Suite #2: Non-Equality check
erlunit: | --> 1 /= 10 as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #1: all 9 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #2: all 9 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 18, Passed: 18, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Demonstration of Macros
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Suite #1: Expect 1 == 1.0
erlunit: | --> 1 as it should.
erlunit: + ok | Suite #1: Expect 1 == 1
erlunit: | --> 1 as it should.
erlunit: + ok | Suite #1: 1 / 1
erlunit: | --> passes ok.
erlunit: + ok | Suite #2: 1 / zero ( )
erlunit: | --> runs into error (badarith), failing as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #1: all 3 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #2: all 1 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 4, Passed: 4, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--
***************************************************************************
Demonstrating the use of suite functions.
***************************************************************************
------------------------------------------------------------------------o--
---ooo-ooo--o--o--o-o--o-o-ooo------------------------------------------o--
---Oo--OoO--O--O--O-Oo-O-O--O-------------------------------------------o--
---Ooo-O--O-Ooo-OO--O-oO-O--O-------------------------------------------o--
------------------------------------------------------------------------o--
Erlunit 0.2.8.2/alpha (c) 2010 Eonblast Corporation http://www.eonblast.com
------------------------------------------------------------------------o--
erlunit: Start of Tests.
erlunit: + ok | Suite #1/Simple: Check for true
erlunit: | --> evaluates to true.
erlunit: + ok | Suite #1/Simple: Equality check
erlunit: | --> 1 as it should.
erlunit: + ok | Suite #1/Simple: Check for exception
erlunit: | --> runs into error (badarith), failing as it should.
erlunit: Suite #2 gives names to individual checks
erlunit: + ok | Suite #2/Simple (verbose): One Equals One
erlunit: | --> evaluates to true.
erlunit: + ok | Suite #2/Simple (verbose): One Equals Zero
erlunit: | --> evaluates to false.
erlunit: + ok | Suite #2/Simple (verbose): One Does Not Equal Two
erlunit: | --> evaluates to false, not true, as it should.
erlunit: + ok | Suite #2/Simple (verbose): Foo Is Not True
erlunit: | --> evaluates to foo, not false, as it should.
erlunit: + ok | Suite #2/Simple (verbose): One Not Not Equals One
erlunit: | --> evaluates to true, not false, as it should.
erlunit: + ok | Suite #2/Simple (verbose): Bar Is Not False
erlunit: | --> evaluates to bar, not false, as it should.
erlunit: + ok | Suite #2/Simple (verbose): Once More Equality
erlunit: | --> 1 as it should.
erlunit: + ok | Suite #2/Simple (verbose): And Non-Equality
erlunit: | --> 1 /= 0 as it should.
erlunit: + ok | Suite #2/Simple (verbose): Trivial Fun
erlunit: | --> passes ok.
erlunit: + ok | Suite #2/Simple (verbose): Div By Zero
erlunit: | --> runs into error (badarith), failing as it should.
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #1/Simple: all 3 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: ------------------------------------------------------------------
erlunit: + OK | Suite #2/Simple (verbose): all 10 tests passed.
erlunit: ------------------------------------------------------------------
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
erlunit: Overall passed - Tests: 13, Passed: 13, Failed: 0, Crashes: 0
erlunit: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
--o---------------------------------------------------------------------o--