@@ -58,6 +58,69 @@ class AlgebraInvariantTests extends CatsSuite {
5858 implicit val arbCommutativeGroupInt : Arbitrary [CommutativeGroup [Int ]] =
5959 Arbitrary (genCommutativeGroupInt)
6060
61+ test(" Semigroup combineAllOption after imap with id is consistent" ){
62+ forAll { (s : Semigroup [Int ], is : Vector [Int ]) =>
63+ val S : Semigroup [Int ] = s.imap(identity)(identity)
64+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
65+ }
66+ }
67+
68+ test(" Monoid combineAllOption after imap with id is consistent" ){
69+ forAll { (s : Monoid [Int ], is : Vector [Int ]) =>
70+ val S : Monoid [Int ] = s.imap(identity)(identity)
71+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
72+ }
73+ }
74+
75+ test(" Group combineAllOption after imap with id is consistent" ){
76+ forAll { (s : Group [Int ], is : Vector [Int ]) =>
77+ val S : Group [Int ] = s.imap(identity)(identity)
78+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
79+ }
80+ }
81+
82+ test(" CommuativeSemigroup combineAllOption after imap with id is consistent" ){
83+ forAll { (s : CommutativeSemigroup [Int ], is : Vector [Int ]) =>
84+ val S : CommutativeSemigroup [Int ] = s.imap(identity)(identity)
85+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
86+ }
87+ }
88+
89+ test(" CommutativeMonoid combineAllOption after imap with id is consistent" ){
90+ forAll { (s : CommutativeMonoid [Int ], is : Vector [Int ]) =>
91+ val S : CommutativeMonoid [Int ] = s.imap(identity)(identity)
92+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
93+ }
94+ }
95+
96+ test(" CommutativeGroup combineAllOption after imap with id is consistent" ){
97+ forAll { (s : CommutativeGroup [Int ], is : Vector [Int ]) =>
98+ val S : CommutativeGroup [Int ] = s.imap(identity)(identity)
99+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
100+ }
101+ }
102+
103+ test(" Band combineAllOption after imap with id is consistent" ){
104+ forAll { (s : Band [Set [Int ]], is : Vector [Set [Int ]]) =>
105+ val S : Band [Set [Int ]] = s.imap(identity)(identity)
106+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
107+ }
108+ }
109+
110+ test(" Semilattice combineAllOption after imap with id is consistent" ){
111+ forAll { (s : Semilattice [Set [Int ]], is : Vector [Set [Int ]]) =>
112+ val S : Semilattice [Set [Int ]] = s.imap(identity)(identity)
113+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
114+ }
115+ }
116+
117+ test(" BoundedSemilattice combineAllOption after imap with id is consistent" ){
118+ forAll { (s : BoundedSemilattice [Set [Int ]], is : Vector [Set [Int ]]) =>
119+ val S : BoundedSemilattice [Set [Int ]] = s.imap(identity)(identity)
120+ S .combineAllOption(is) should === (is.reduceOption(s.combine))
121+ }
122+ }
123+
61124
62125 checkAll(" Invariant[Semigroup]" , InvariantTests [Semigroup ].invariant[Int , Int , Int ])
63126 checkAll(" Invariant[Semigroup]" , SerializableTests .serializable(Invariant [Semigroup ]))
0 commit comments