@@ -123,14 +123,30 @@ class Constructable {
123
123
return numCopyAssignmentCalls;
124
124
}
125
125
126
- friend bool operator ==(const Constructable & c0, const Constructable & c1) {
126
+ friend bool operator ==(const Constructable &c0, const Constructable &c1) {
127
127
return c0.getValue () == c1.getValue ();
128
128
}
129
129
130
- friend bool LLVM_ATTRIBUTE_UNUSED
131
- operator !=( const Constructable & c0, const Constructable & c1) {
130
+ friend bool LLVM_ATTRIBUTE_UNUSED operator !=( const Constructable &c0,
131
+ const Constructable &c1) {
132
132
return c0.getValue () != c1.getValue ();
133
133
}
134
+
135
+ friend bool operator <(const Constructable &c0, const Constructable &c1) {
136
+ return c0.getValue () < c1.getValue ();
137
+ }
138
+ friend bool LLVM_ATTRIBUTE_UNUSED operator <=(const Constructable &c0,
139
+ const Constructable &c1) {
140
+ return c0.getValue () <= c1.getValue ();
141
+ }
142
+ friend bool LLVM_ATTRIBUTE_UNUSED operator >(const Constructable &c0,
143
+ const Constructable &c1) {
144
+ return c0.getValue () > c1.getValue ();
145
+ }
146
+ friend bool LLVM_ATTRIBUTE_UNUSED operator >=(const Constructable &c0,
147
+ const Constructable &c1) {
148
+ return c0.getValue () >= c1.getValue ();
149
+ }
134
150
};
135
151
136
152
int Constructable::numConstructorCalls;
@@ -766,8 +782,8 @@ TYPED_TEST(SmallVectorTest, InsertEmptyRangeTest) {
766
782
}
767
783
768
784
// Comparison tests.
769
- TYPED_TEST (SmallVectorTest, ComparisonTest ) {
770
- SCOPED_TRACE (" ComparisonTest " );
785
+ TYPED_TEST (SmallVectorTest, ComparisonEqualityTest ) {
786
+ SCOPED_TRACE (" ComparisonEqualityTest " );
771
787
772
788
this ->makeSequence (this ->theVector , 1 , 3 );
773
789
this ->makeSequence (this ->otherVector , 1 , 3 );
@@ -782,6 +798,36 @@ TYPED_TEST(SmallVectorTest, ComparisonTest) {
782
798
EXPECT_TRUE (this ->theVector != this ->otherVector );
783
799
}
784
800
801
+ // Comparison tests.
802
+ TYPED_TEST (SmallVectorTest, ComparisonLessThanTest) {
803
+ SCOPED_TRACE (" ComparisonLessThanTest" );
804
+
805
+ this ->theVector = {1 , 2 , 4 };
806
+ this ->otherVector = {1 , 4 };
807
+
808
+ EXPECT_TRUE (this ->theVector < this ->otherVector );
809
+ EXPECT_TRUE (this ->theVector <= this ->otherVector );
810
+ EXPECT_FALSE (this ->theVector > this ->otherVector );
811
+ EXPECT_FALSE (this ->theVector >= this ->otherVector );
812
+
813
+ EXPECT_FALSE (this ->otherVector < this ->theVector );
814
+ EXPECT_FALSE (this ->otherVector <= this ->theVector );
815
+ EXPECT_TRUE (this ->otherVector > this ->theVector );
816
+ EXPECT_TRUE (this ->otherVector >= this ->theVector );
817
+
818
+ this ->otherVector = {1 , 2 , 4 };
819
+
820
+ EXPECT_FALSE (this ->theVector < this ->otherVector );
821
+ EXPECT_TRUE (this ->theVector <= this ->otherVector );
822
+ EXPECT_FALSE (this ->theVector > this ->otherVector );
823
+ EXPECT_TRUE (this ->theVector >= this ->otherVector );
824
+
825
+ EXPECT_FALSE (this ->otherVector < this ->theVector );
826
+ EXPECT_TRUE (this ->otherVector <= this ->theVector );
827
+ EXPECT_FALSE (this ->otherVector > this ->theVector );
828
+ EXPECT_TRUE (this ->otherVector >= this ->theVector );
829
+ }
830
+
785
831
// Constant vector tests.
786
832
TYPED_TEST (SmallVectorTest, ConstVectorTest) {
787
833
const TypeParam constVector;
0 commit comments