-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Values function return 1.23 iterator
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//go:build go1.23 | ||
// +build go1.23 | ||
|
||
package mapset | ||
|
||
import "testing" | ||
|
||
func TestAll123(t *testing.T) { | ||
a := NewSet[string]() | ||
|
||
a.Add("Z") | ||
a.Add("Y") | ||
a.Add("X") | ||
a.Add("W") | ||
|
||
b := NewSet[string]() | ||
for elem := range Values(a) { | ||
b.Add(elem) | ||
} | ||
|
||
if !a.Equal(b) { | ||
t.Error("The sets are not equal after iterating (Each) through the first set") | ||
} | ||
|
||
var count int | ||
for range Values(a) { | ||
if count == 2 { | ||
break | ||
} | ||
count++ | ||
} | ||
|
||
if count != 2 { | ||
t.Error("Iteration should stop on the way") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters