Skip to content

Commit 4042693

Browse files
committed
Benchmarks use longer static strings
1 parent 1b636e9 commit 4042693

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

integration-tests/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ fn main() {
99
"a",
1010
"b",
1111
"address",
12+
"defaults",
1213
"area",
1314
"body",
1415
"font-weight",

integration-tests/src/bench.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bench_all!([eq ne lt clone_string]
153153
for longer_string = super::longer_dynamic_a, super::longer_dynamic_b);
154154

155155
bench_all!([eq ne intern as_ref clone is_static lt]
156-
for static_atom = test_atom!("a"), test_atom!("b"));
156+
for static_atom = test_atom!("defaults"), test_atom!("font-weight"));
157157

158158
bench_all!([intern as_ref clone is_inline]
159159
for short_inline_atom = mk("e"), mk("f"));
@@ -168,13 +168,13 @@ bench_all!([eq ne intern as_ref clone is_dynamic lt]
168168
for longer_dynamic_atom = mk(super::longer_dynamic_a), mk(super::longer_dynamic_b));
169169

170170
bench_all!([intern as_ref clone is_static]
171-
for static_at_runtime = mk("a"), mk("b"));
171+
for static_at_runtime = mk("defaults"), mk("font-weight"));
172172

173173
bench_all!([ne lt x_static y_inline]
174-
for static_vs_inline = test_atom!("a"), mk("f"));
174+
for static_vs_inline = test_atom!("defaults"), mk("f"));
175175

176176
bench_all!([ne lt x_static y_dynamic]
177-
for static_vs_dynamic = test_atom!("a"), mk(super::longer_dynamic_b));
177+
for static_vs_dynamic = test_atom!("defaults"), mk(super::longer_dynamic_b));
178178

179179
bench_all!([ne lt x_inline y_dynamic]
180180
for inline_vs_dynamic = mk("e"), mk(super::longer_dynamic_b));

integration-tests/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ fn test_as_slice() {
4545
#[test]
4646
fn test_types() {
4747
assert!(Atom::from("").is_static());
48+
assert!(Atom::from("defaults").is_static());
49+
assert!(Atom::from("font-weight").is_static());
4850
assert!(Atom::from("id").is_static());
4951
assert!(Atom::from("body").is_static());
5052
assert!(Atom::from("a").is_static());
53+
assert!(Atom::from("address").is_static());
5154
assert!(Atom::from("c").is_inline());
5255
assert!(Atom::from("zz").is_inline());
5356
assert!(Atom::from("zzz").is_inline());
@@ -168,6 +171,8 @@ fn repr() {
168171
// static atom table, the tag values, etc.
169172

170173
// Static atoms
174+
check_static("defaults", test_atom!("defaults"));
175+
check_static("font-weight", test_atom!("font-weight"));
171176
check_static("a", test_atom!("a"));
172177
check_static("address", test_atom!("address"));
173178
check_static("area", test_atom!("area"));
@@ -193,7 +198,9 @@ fn test_threads() {
193198

194199
#[test]
195200
fn atom_macro() {
201+
assert_eq!(test_atom!("a"), Atom::from("a"));
196202
assert_eq!(test_atom!("body"), Atom::from("body"));
203+
assert_eq!(test_atom!("address"), Atom::from("address"));
197204
assert_eq!(test_atom!("font-weight"), Atom::from("font-weight"));
198205
}
199206

@@ -292,6 +299,7 @@ fn test_from_string() {
292299

293300
#[test]
294301
fn test_try_static() {
302+
assert!(Atom::try_static("defaults").is_some());
295303
assert!(Atom::try_static("head").is_some());
296304
assert!(Atom::try_static("not in the static table").is_none());
297305
}

0 commit comments

Comments
 (0)