diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 19:48:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 19:48:56 -0700 |
commit | 6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 (patch) | |
tree | dec4043f2d62f5dd02156d369e20af247881e2ac /064list.mu | |
parent | 1627d836b46440f57d766b154ec488fa2e5a1e06 (diff) | |
download | mu-6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945.tar.gz |
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.
Diffstat (limited to '064list.mu')
-rw-r--r-- | 064list.mu | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/064list.mu b/064list.mu index 4c48f8e2..cf7be09c 100644 --- a/064list.mu +++ b/064list.mu @@ -69,11 +69,11 @@ def insert x:_elem, in:&:list:_elem -> in:&:list:_elem [ ] scenario inserting-into-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list list2:&:list:char <- rest list # inside list list2 <- insert 6, list2 # check structure @@ -95,11 +95,11 @@ scenario inserting-into-list [ ] scenario inserting-at-end-of-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list list2:&:list:char <- rest list # inside list list2 <- rest list2 # now at end of list list2 <- insert 6, list2 @@ -122,11 +122,11 @@ scenario inserting-at-end-of-list [ ] scenario inserting-after-start-of-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list list <- insert 6, list # check structure like before list2:&:list:char <- copy list @@ -176,11 +176,11 @@ def remove x:&:list:_elem/contained-in:in, in:&:list:_elem -> in:&:list:_elem [ ] scenario removing-from-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list list2:&:list:char <- rest list # second element list <- remove list2, list 10:bool/raw <- equal list2, 0 @@ -200,11 +200,11 @@ scenario removing-from-list [ ] scenario removing-from-start-of-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list list <- remove list, list # check structure like before list2:&:list:char <- copy list @@ -221,11 +221,11 @@ scenario removing-from-start-of-list [ ] scenario removing-from-end-of-list [ + local-scope + list:&:list:char <- push 3, 0 + list <- push 4, list + list <- push 5, list run [ - local-scope - list:&:list:char <- push 3, 0 - list <- push 4, list - list <- push 5, list # delete last element list2:&:list:char <- rest list list2 <- rest list2 @@ -247,9 +247,9 @@ scenario removing-from-end-of-list [ ] scenario removing-from-singleton-list [ + local-scope + list:&:list:char <- push 3, 0 run [ - local-scope - list:&:list:char <- push 3, 0 list <- remove list, list 1:num/raw <- copy list ] @@ -271,11 +271,11 @@ def reverse list:&:list:_elem temp:&:list:_elem -> result:&:list:_elem [ ] scenario reverse-list [ + local-scope + list:&:list:number <- push 1, 0 + list <- push 2, list + list <- push 3, list run [ - local-scope - list:&:list:number <- push 1, 0 - list <- push 2, list - list <- push 3, list stash [list:], list list <- reverse list stash [reversed:], list @@ -339,8 +339,11 @@ def to-buffer in:&:list:_elem, buf:&:buffer -> buf:&:buffer [ ] scenario stash-empty-list [ + local-scope x:&:list:num <- copy 0 - stash x + run [ + stash x + ] trace-should-contain [ app: [] ] |