Skip to content

Commit a4705fd

Browse files
refactor!: use IndexMaps instead of BTreeMaps for test and subtest order
1 parent 5299e97 commit a4705fd

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

moz-webgpu-cts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum-map = { version = "2.7.3", features = ["serde"] }
2424
enumset = { version = "1.1.3", features = ["serde"] }
2525
env_logger = { workspace = true }
2626
format = { workspace = true }
27-
indexmap = { workspace = true }
27+
indexmap = { workspace = true, features = ["serde"] }
2828
itertools = "0.11.0"
2929
joinery = "3.1.0"
3030
lets_find_up = "0.0.3"

moz-webgpu-cts/src/process_reports.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
#[derive(Debug, Default)]
4747
pub(crate) struct TestEntry {
4848
pub entry: Entry<TestOutcome>,
49-
pub subtests: BTreeMap<String, Entry<SubtestOutcome>>,
49+
pub subtests: IndexMap<String, Entry<SubtestOutcome>>,
5050
}
5151

5252
#[derive(Debug)]
@@ -565,7 +565,7 @@ pub(crate) fn process_reports(
565565
},
566566
))
567567
})
568-
.collect::<BTreeMap<_, _>>();
568+
.collect::<IndexMap<_, _>>();
569569

570570
Some((test_entry_path, (properties, subtests)))
571571
},

moz-webgpu-cts/src/wpt/metadata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::{
2-
collections::BTreeMap,
32
fmt::{self, Display, Formatter},
43
hash::Hash,
54
};
@@ -8,6 +7,7 @@ use clap::ValueEnum;
87
use enum_map::Enum;
98
use enumset::EnumSetType;
109
use format::lazy_format;
10+
use indexmap::IndexMap;
1111
use joinery::JoinableIterator;
1212
use maybe_collapsed::MaybeCollapsed;
1313
use serde::{Deserialize, Serialize};
@@ -43,7 +43,7 @@ pub(crate) mod properties;
4343
#[derive(Clone, Debug, Default, Serialize)]
4444
pub struct File {
4545
pub properties: FileProps,
46-
pub tests: BTreeMap<SectionHeader, Test>,
46+
pub tests: IndexMap<SectionHeader, Test>,
4747
}
4848

4949
impl File {
@@ -647,7 +647,7 @@ impl ImplementationStatus {
647647
}
648648

649649
#[derive(Debug, Default)]
650-
pub struct Tests(BTreeMap<SectionHeader, Test>);
650+
pub struct Tests(IndexMap<SectionHeader, Test>);
651651

652652
impl<'a> metadata::Tests<'a> for Tests {
653653
type Test = Test;
@@ -670,7 +670,7 @@ impl<'a> metadata::Tests<'a> for Tests {
670670
#[derive(Clone, Debug, Default, Serialize)]
671671
pub struct Test {
672672
pub properties: TestProps<TestOutcome>,
673-
pub subtests: BTreeMap<SectionHeader, Subtest>,
673+
pub subtests: IndexMap<SectionHeader, Subtest>,
674674
}
675675

676676
#[cfg(test)]
@@ -694,7 +694,7 @@ impl metadata::Test<'_> for Test {
694694
}
695695

696696
#[derive(Default)]
697-
pub struct Subtests(BTreeMap<SectionHeader, Subtest>);
697+
pub struct Subtests(IndexMap<SectionHeader, Subtest>);
698698

699699
impl<'a> metadata::Subtests<'a> for Subtests {
700700
type Subtest = Subtest;

0 commit comments

Comments
 (0)