Skip to content

Commit

Permalink
tests: Test multiple count() implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Feb 7, 2025
1 parent 45a564a commit e735fa4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/stdlib/iterator-count1.dora
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
//= ignore

use std::traits::IntoIterator;
use std::traits::Iterator;
use std::collections::HashMap;

fn main() {
let x = Vec[Int]::new(1, 2, 3, 4, 5);
assert(x.iter().count() == 5);

let x = Array[Int]::new(1, 2, 3, 4, 5);
assert(x.iter().count() == 5);

let x = HashMap[Int, String]::new((1, "one"), (2, "two"), (3, "three"));
assert(x.iter().count() == 3);
}

0 comments on commit e735fa4

Please sign in to comment.