Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a9d112b3
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9d112b3
编写于
6月 12, 2014
作者:
L
Luqman Aden
提交者:
Luqman Aden
7月 09, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libcollections: Use iterators instead of old-style loops.
上级
1eb4ce02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
38 deletion
+14
-38
src/libcollections/bitv.rs
src/libcollections/bitv.rs
+10
-34
src/libcollections/treemap.rs
src/libcollections/treemap.rs
+4
-4
未找到文件。
src/libcollections/bitv.rs
浏览文件 @
a9d112b3
...
...
@@ -1426,18 +1426,14 @@ fn test_big_difference() {
fn
test_small_clear
()
{
let
mut
b
=
Bitv
::
with_capacity
(
14
,
true
);
b
.clear
();
BitvSet
::
from_bitv
(
b
)
.iter
()
.advance
(|
i
|
{
fail
!
(
"found 1 at {:?}"
,
i
)
});
assert
!
(
b
.none
());
}
#[test]
fn
test_big_clear
()
{
let
mut
b
=
Bitv
::
with_capacity
(
140
,
true
);
b
.clear
();
BitvSet
::
from_bitv
(
b
)
.iter
()
.advance
(|
i
|
{
fail
!
(
"found 1 at {:?}"
,
i
)
});
assert
!
(
b
.none
());
}
#[test]
...
...
@@ -1494,14 +1490,9 @@ fn test_bitv_set_intersection() {
assert
!
(
b
.insert
(
5
));
assert
!
(
b
.insert
(
3
));
let
mut
i
=
0
;
let
expected
=
[
3
,
5
,
11
,
77
];
a
.intersection
(
&
b
)
.advance
(|
x
|
{
assert_eq!
(
x
,
expected
[
i
]);
i
+=
1
;
true
});
assert_eq!
(
i
,
expected
.len
());
let
actual
=
a
.intersection
(
&
b
)
.collect
::
<
Vec
<
uint
>>
();
assert_eq!
(
actual
.as_slice
(),
expected
.as_slice
());
}
#[test]
...
...
@@ -1518,14 +1509,9 @@ fn test_bitv_set_difference() {
assert
!
(
b
.insert
(
3
));
assert
!
(
b
.insert
(
200
));
let
mut
i
=
0
;
let
expected
=
[
1
,
5
,
500
];
a
.difference
(
&
b
)
.advance
(|
x
|
{
assert_eq!
(
x
,
expected
[
i
]);
i
+=
1
;
true
});
assert_eq!
(
i
,
expected
.len
());
let
actual
=
a
.difference
(
&
b
)
.collect
::
<
Vec
<
uint
>>
();
assert_eq!
(
actual
.as_slice
(),
expected
.as_slice
());
}
#[test]
...
...
@@ -1544,14 +1530,9 @@ fn test_bitv_set_symmetric_difference() {
assert
!
(
b
.insert
(
14
));
assert
!
(
b
.insert
(
220
));
let
mut
i
=
0
;
let
expected
=
[
1
,
5
,
11
,
14
,
220
];
a
.symmetric_difference
(
&
b
)
.advance
(|
x
|
{
assert_eq!
(
x
,
expected
[
i
]);
i
+=
1
;
true
});
assert_eq!
(
i
,
expected
.len
());
let
actual
=
a
.symmetric_difference
(
&
b
)
.collect
::
<
Vec
<
uint
>>
();
assert_eq!
(
actual
.as_slice
(),
expected
.as_slice
());
}
#[test]
...
...
@@ -1573,14 +1554,9 @@ fn test_bitv_set_union() {
assert
!
(
b
.insert
(
13
));
assert
!
(
b
.insert
(
19
));
let
mut
i
=
0
;
let
expected
=
[
1
,
3
,
5
,
9
,
11
,
13
,
19
,
24
,
160
];
a
.union
(
&
b
)
.advance
(|
x
|
{
assert_eq!
(
x
,
expected
[
i
]);
i
+=
1
;
true
});
assert_eq!
(
i
,
expected
.len
());
let
actual
=
a
.union
(
&
b
)
.collect
::
<
Vec
<
uint
>>
();
assert_eq!
(
actual
.as_slice
(),
expected
.as_slice
());
}
#[test]
...
...
src/libcollections/treemap.rs
浏览文件 @
a9d112b3
...
...
@@ -1770,7 +1770,7 @@ fn check(a: &[int],
#[test]
fn
test_intersection
()
{
fn
check_intersection
(
a
:
&
[
int
],
b
:
&
[
int
],
expected
:
&
[
int
])
{
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.intersection
(
y
)
.a
dvance
(
f
))
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.intersection
(
y
)
.a
ll
(
f
))
}
check_intersection
([],
[],
[]);
...
...
@@ -1786,7 +1786,7 @@ fn check_intersection(a: &[int], b: &[int], expected: &[int]) {
#[test]
fn
test_difference
()
{
fn
check_difference
(
a
:
&
[
int
],
b
:
&
[
int
],
expected
:
&
[
int
])
{
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.difference
(
y
)
.a
dvance
(
f
))
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.difference
(
y
)
.a
ll
(
f
))
}
check_difference
([],
[],
[]);
...
...
@@ -1804,7 +1804,7 @@ fn check_difference(a: &[int], b: &[int], expected: &[int]) {
fn
test_symmetric_difference
()
{
fn
check_symmetric_difference
(
a
:
&
[
int
],
b
:
&
[
int
],
expected
:
&
[
int
])
{
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.symmetric_difference
(
y
)
.a
dvance
(
f
))
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.symmetric_difference
(
y
)
.a
ll
(
f
))
}
check_symmetric_difference
([],
[],
[]);
...
...
@@ -1819,7 +1819,7 @@ fn check_symmetric_difference(a: &[int], b: &[int],
fn
test_union
()
{
fn
check_union
(
a
:
&
[
int
],
b
:
&
[
int
],
expected
:
&
[
int
])
{
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.union
(
y
)
.a
dvance
(
f
))
check
(
a
,
b
,
expected
,
|
x
,
y
,
f
|
x
.union
(
y
)
.a
ll
(
f
))
}
check_union
([],
[],
[]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录