test: Switch lib-either over to interior vectors. Puts out burning tinderbox.
This commit is contained in:
parent
ab579e1c9f
commit
27834c2a65
@ -2,7 +2,7 @@
|
||||
|
||||
use std;
|
||||
import std::either::*;
|
||||
import std::vec::len;
|
||||
import std::ivec::len;
|
||||
|
||||
fn test_either_left() {
|
||||
auto val = left(10);
|
||||
@ -19,57 +19,57 @@ fn test_either_right() {
|
||||
}
|
||||
|
||||
fn test_lefts() {
|
||||
auto input = [left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto input = ~[left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto result = lefts(input);
|
||||
assert (result == [10, 12, 14]);
|
||||
assert (result == ~[10, 12, 14]);
|
||||
}
|
||||
|
||||
fn test_lefts_none() {
|
||||
let vec[t[int, int]] input = [right(10),
|
||||
let (t[int, int])[] input = ~[right(10),
|
||||
right(10)];
|
||||
auto result = lefts(input);
|
||||
assert (len(result) == 0u);
|
||||
}
|
||||
|
||||
fn test_lefts_empty() {
|
||||
let vec[t[int, int]] input = [];
|
||||
let (t[int, int])[] input = ~[];
|
||||
auto result = lefts(input);
|
||||
assert (len(result) == 0u);
|
||||
}
|
||||
|
||||
fn test_rights() {
|
||||
auto input = [left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto input = ~[left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto result = rights(input);
|
||||
assert (result == [11, 13]);
|
||||
assert (result == ~[11, 13]);
|
||||
}
|
||||
|
||||
fn test_rights_none() {
|
||||
let vec[t[int, int]] input = [left(10),
|
||||
let (t[int, int])[] input = ~[left(10),
|
||||
left(10)];
|
||||
auto result = rights(input);
|
||||
assert (len(result) == 0u);
|
||||
}
|
||||
|
||||
fn test_rights_empty() {
|
||||
let vec[t[int, int]] input = [];
|
||||
let (t[int, int])[] input = ~[];
|
||||
auto result = rights(input);
|
||||
assert (len(result) == 0u);
|
||||
}
|
||||
|
||||
fn test_partition() {
|
||||
auto input = [left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto input = ~[left(10),
|
||||
right(11),
|
||||
left(12),
|
||||
right(13),
|
||||
left(14)];
|
||||
auto result = partition(input);
|
||||
assert (result._0.(0) == 10);
|
||||
assert (result._0.(1) == 12);
|
||||
@ -79,7 +79,7 @@ fn test_partition() {
|
||||
}
|
||||
|
||||
fn test_partition_no_lefts() {
|
||||
let vec[t[int, int]] input = [right(10),
|
||||
let (t[int, int])[] input = ~[right(10),
|
||||
right(11)];
|
||||
auto result = partition(input);
|
||||
assert (len(result._0) == 0u);
|
||||
@ -87,7 +87,7 @@ fn test_partition_no_lefts() {
|
||||
}
|
||||
|
||||
fn test_partition_no_rights() {
|
||||
let vec[t[int, int]] input = [left(10),
|
||||
let (t[int, int])[] input = ~[left(10),
|
||||
left(11)];
|
||||
auto result = partition(input);
|
||||
assert (len(result._0) == 2u);
|
||||
@ -95,7 +95,7 @@ fn test_partition_no_rights() {
|
||||
}
|
||||
|
||||
fn test_partition_empty() {
|
||||
let vec[t[int, int]] input = [];
|
||||
let (t[int, int])[] input = ~[];
|
||||
auto result = partition(input);
|
||||
assert (len(result._0) == 0u);
|
||||
assert (len(result._1) == 0u);
|
||||
@ -114,4 +114,4 @@ fn main() {
|
||||
test_partition_no_lefts();
|
||||
test_partition_no_rights();
|
||||
test_partition_empty();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user