From 6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 28 Sep 2016 19:48:56 -0700 Subject: 3429 - standardize Mu scenarios A long-standing problem has been that I couldn't spread code across 'run' blocks because they were separate scopes, so I've ended up making them effectively comments. Running code inside a 'run' block is identical in every way to simply running the code directly. The 'run' block is merely a visual aid to separate setup from the component under test. In the process I've also standardized all Mu scenarios to always run in a local scope, and only use (raw) numeric addresses for values they want to check later. --- 075channel.mu | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to '075channel.mu') diff --git a/075channel.mu b/075channel.mu index ebac99a6..7819f787 100644 --- a/075channel.mu +++ b/075channel.mu @@ -177,9 +177,9 @@ scenario channel-initialization [ ] scenario channel-write-increments-free [ + local-scope + _, sink:&:sink:num <- new-channel 3/capacity run [ - local-scope - _, sink:&:sink:num <- new-channel 3/capacity sink <- write sink, 34 chan:&:channel:num <- get *sink, chan:offset 10:num/raw <- get *chan, first-full:offset @@ -192,10 +192,10 @@ scenario channel-write-increments-free [ ] scenario channel-read-increments-full [ + local-scope + source:&:source:num, sink:&:sink:num <- new-channel 3/capacity + sink <- write sink, 34 run [ - local-scope - source:&:source:num, sink:&:sink:num <- new-channel 3/capacity - sink <- write sink, 34 _, _, source <- read source chan:&:channel:num <- get *source, chan:offset 10:num/raw <- get *chan, first-full:offset @@ -208,14 +208,14 @@ scenario channel-read-increments-full [ ] scenario channel-wrap [ + local-scope + # channel with just 1 slot + source:&:source:num, sink:&:sink:num <- new-channel 1/capacity + chan:&:channel:num <- get *source, chan:offset + # write and read a value + sink <- write sink, 34 + _, _, source <- read source run [ - local-scope - # channel with just 1 slot - source:&:source:num, sink:&:sink:num <- new-channel 1/capacity - chan:&:channel:num <- get *source, chan:offset - # write and read a value - sink <- write sink, 34 - _, _, source <- read source # first-free will now be 1 10:num/raw <- get *chan, first-free:offset 11:num/raw <- get *chan, first-free:offset @@ -249,9 +249,10 @@ scenario channel-new-empty-not-full [ ] scenario channel-write-not-empty [ + local-scope + source:&:source:num, sink:&:sink:num <- new-channel 3/capacity + chan:&:channel:num <- get *source, chan:offset run [ - source:&:source:num, sink:&:sink:num <- new-channel 3/capacity - chan:&:channel:num <- get *source, chan:offset sink <- write sink, 34 10:bool/raw <- channel-empty? chan 11:bool/raw <- channel-full? chan @@ -263,10 +264,10 @@ scenario channel-write-not-empty [ ] scenario channel-write-full [ + local-scope + source:&:source:num, sink:&:sink:num <- new-channel 1/capacity + chan:&:channel:num <- get *source, chan:offset run [ - local-scope - source:&:source:num, sink:&:sink:num <- new-channel 1/capacity - chan:&:channel:num <- get *source, chan:offset sink <- write sink, 34 10:bool/raw <- channel-empty? chan 11:bool/raw <- channel-full? chan @@ -278,11 +279,11 @@ scenario channel-write-full [ ] scenario channel-read-not-full [ + local-scope + source:&:source:num, sink:&:sink:num <- new-channel 1/capacity + chan:&:channel:num <- get *source, chan:offset + sink <- write sink, 34 run [ - local-scope - source:&:source:num, sink:&:sink:num <- new-channel 1/capacity - chan:&:channel:num <- get *source, chan:offset - sink <- write sink, 34 _, _, source <- read source 10:bool/raw <- channel-empty? chan 11:bool/raw <- channel-full? chan -- cgit 1.4.1-2-gfad0 i/profani-tty/blame/src/xmpp/blocking.h?id=cc164728a7db5f909f570300db74a8dc818c5407'>^
b8c94376 ^
706af9a9 ^
b8c94376 ^













e8fc80f5 ^
b8c94376 ^


















a2726b6a ^
b8c94376 ^

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