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 /063array.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 '063array.mu')
-rw-r--r-- | 063array.mu | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/063array.mu b/063array.mu index 001ff7a4..f0679c6d 100644 --- a/063array.mu +++ b/063array.mu @@ -58,9 +58,9 @@ recipe fill array:&:@:num -> array:&:@:num [ ] scenario fill-on-an-empty-array [ + local-scope + array:&:@:num <- new number:type, 3 run [ - local-scope - array:&:@:num <- new number:type, 3 array <- fill array, 1 2 3 10:@:num/raw <- copy *array ] @@ -73,10 +73,10 @@ scenario fill-on-an-empty-array [ ] scenario fill-overwrites-existing-values [ + local-scope + array:&:@:num <- new number:type, 3 + *array <- put-index *array, 0, 4 run [ - local-scope - array:&:@:num <- new number:type, 3 - *array <- put-index *array, 0, 4 array <- fill array, 1 2 3 10:@:num/raw <- copy *array ] @@ -89,9 +89,9 @@ scenario fill-overwrites-existing-values [ ] scenario fill-exits-gracefully-when-given-no-ingredients [ + local-scope + array:&:@:num <- new number:type, 3 run [ - local-scope - array:&:@:num <- new number:type, 3 array <- fill array 10:@:num/raw <- copy *array ] @@ -115,10 +115,10 @@ recipe swap array:&:@:num, index1:num, index2:num -> array:&:@:num [ ] scenario swap-works [ + local-scope + array:&:@:num <- new number:type, 4 + array <- fill array, 4 3 2 1 run [ - local-scope - array:&:@:num <- new number:type, 4 - array <- fill array, 4 3 2 1 array <- swap array, 0, 2 10:num/raw <- index *array, 0 11:num/raw <- index *array, 2 @@ -148,10 +148,10 @@ def reverse array:&:@:_elem -> array:&:@:_elem [ ] scenario reverse-array-odd-length [ + local-scope + array:&:@:num <- new number:type, 3 + array <- fill array, 3 2 1 run [ - local-scope - array:&:@:num <- new number:type, 3 - array <- fill array, 3 2 1 array <- reverse array 10:@:num/raw <- copy *array ] @@ -164,10 +164,10 @@ scenario reverse-array-odd-length [ ] scenario reverse-array-even-length [ + local-scope + array:&:@:num <- new number:type, 4 + array <- fill array, 4 3 2 1 run [ - local-scope - array:&:@:num <- new number:type, 4 - array <- fill array, 4 3 2 1 array <- reverse array 10:@:num/raw <- copy *array ] |