mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
test-test262: Use HashMap::try_ensure_capacity
This commit is contained in:
parent
eacfcac932
commit
7c82713ecb
1 changed files with 4 additions and 4 deletions
|
@ -222,10 +222,10 @@ public:
|
||||||
NonnullOwnPtr<Core::Stream::File> m_output;
|
NonnullOwnPtr<Core::Stream::File> m_output;
|
||||||
};
|
};
|
||||||
|
|
||||||
static HashMap<size_t, TestResult> run_test_files(Span<DeprecatedString> files, size_t offset, StringView command, char const* const arguments[])
|
static ErrorOr<HashMap<size_t, TestResult>> run_test_files(Span<DeprecatedString> files, size_t offset, StringView command, char const* const arguments[])
|
||||||
{
|
{
|
||||||
HashMap<size_t, TestResult> results {};
|
HashMap<size_t, TestResult> results {};
|
||||||
results.ensure_capacity(files.size());
|
TRY(results.try_ensure_capacity(files.size()));
|
||||||
size_t test_index = 0;
|
size_t test_index = 0;
|
||||||
|
|
||||||
auto fail_all_after = [&] {
|
auto fail_all_after = [&] {
|
||||||
|
@ -378,9 +378,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
while (index < paths.size()) {
|
while (index < paths.size()) {
|
||||||
print_progress();
|
print_progress();
|
||||||
auto this_batch_size = min(batch_size, paths.size() - index);
|
auto this_batch_size = min(batch_size, paths.size() - index);
|
||||||
auto batch_results = run_test_files(paths.span().slice(index, this_batch_size), index, args[0], raw_args.data());
|
auto batch_results = TRY(run_test_files(paths.span().slice(index, this_batch_size), index, args[0], raw_args.data()));
|
||||||
|
|
||||||
results.ensure_capacity(results.size() + batch_results.size());
|
TRY(results.try_ensure_capacity(results.size() + batch_results.size()));
|
||||||
for (auto& [key, value] : batch_results) {
|
for (auto& [key, value] : batch_results) {
|
||||||
results.set(key, value);
|
results.set(key, value);
|
||||||
++result_counts[static_cast<size_t>(value)];
|
++result_counts[static_cast<size_t>(value)];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue