-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathexample.c
More file actions
45 lines (38 loc) · 912 Bytes
/
Copy pathexample.c
File metadata and controls
45 lines (38 loc) · 912 Bytes
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
#include "bdd-for-c.h"
spec("some feature") {
// These variable definitions must be static because each test
// section (it / before / etc...) is a separate function call
// and thus will just overwrite these otherwise.
static int a;
static int b;
after_each() {
b = 3;
}
describe("sub-feature 1") {
it("should not work") {
a = 2;
b = 2;
check(a + b == 6, "Adding %i to %i did not equal %i", a, b, 6);
}
it("should work") {
check(a + b == 6);
}
}
describe("sub-feature 2") {
context("when a is set to 2") {
before_each() {
a = 2;
}
it("should equal to 5") {
check(a + b == 5);
}
}
}
before_each() {
a = 3;
}
before() {
a = 3;
b = 3;
}
}