[Positioning] ASSERT(a != b) instead of ASSERT_DIFFERS(a, b)

In cxxtest, TS_ASSERT_DIFFERS(a, b) tests !(a == b) and not (a != b).
Therefore, to test a::operator!=(b), we must avoid TS_ASSERT_DIFFERS()
(that will test !a::operator==(b)) and write instead TS_ASSERT(a != b).
This commit is contained in:
Matteo Cypriani 2010-03-05 09:30:29 +01:00
parent 92e58686f8
commit 80fe1c505d
16 changed files with 26 additions and 28 deletions

View File

@ -1,7 +1,5 @@
- Tests unitaires
° Remplacer TS_ASSERT_DIFFERS(a, b) par TS_ASSERT(a != b) pour
tester operator!=() au lieu de !operator==().
° Finir le test de Input.
° Finir le test de Output.
° Finir le test de Positioning.

View File

@ -72,7 +72,7 @@ public:
Point3D point3d2(7,3,24) ;
AccessPoint accesspoint3(point3d1, "10.0.0.1",
"aa:bb:cc:dd:ee:ff", 6, 38, 10) ;
TS_ASSERT_DIFFERS(accesspoint2, accesspoint3) ;
TS_ASSERT(accesspoint2 != accesspoint3) ;
// =
accesspoint2 = accesspoint3 ;

View File

@ -98,7 +98,7 @@ public:
// !=
Area a3(&b1, "My Area", Point3D(1,0,5), Point3D(8,7,4)) ;
TS_ASSERT_DIFFERS(a1, a3) ;
TS_ASSERT(a1 != a3) ;
// =
a2 = a3 ;

View File

@ -65,7 +65,7 @@ public:
// !=
Building b3("B2") ;
TS_ASSERT_DIFFERS(b1, b3) ;
TS_ASSERT(b1 != b3) ;
// =
b2 = b3 ;

View File

@ -84,7 +84,7 @@ public:
Request request2(&mobile1, timestamp1) ;
ReferencePoint referencepoint2 ;
CalibrationRequest calibrationrequest3(request2, &referencepoint2) ;
TS_ASSERT_DIFFERS(calibrationrequest1, calibrationrequest3) ;
TS_ASSERT(calibrationrequest1 != calibrationrequest3) ;
// =
calibrationrequest2 = calibrationrequest3 ;

View File

@ -58,7 +58,7 @@ public:
// !=
direction6 = direction4 ;
TS_ASSERT_DIFFERS(direction5, direction6) ;
TS_ASSERT(direction5 != direction6) ;
// bool
TS_ASSERT(direction1) ;

View File

@ -76,7 +76,7 @@ public:
std::tr1::unordered_map<std::string, Measurement>::const_iterator
measurement_it1 =
request1.get_measurements().find(i->get_mac_addr()) ;
TS_ASSERT_DIFFERS(request1.get_measurements().end(), measurement_it1) ;
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
TS_ASSERT_EQUALS(TestUtil::requests.at(0)->get_measurements().
at(i->get_mac_addr()).get_ss_list(),
measurement_it1->second.get_ss_list()) ;
@ -99,7 +99,7 @@ public:
std::tr1::unordered_map<std::string, Measurement>::const_iterator
measurement_it1 =
request1.get_measurements().find(i->get_mac_addr()) ;
TS_ASSERT_DIFFERS(request1.get_measurements().end(), measurement_it1) ;
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
TS_ASSERT_EQUALS(TestUtil::requests.at(1)->get_measurements().
at(i->get_mac_addr()).get_ss_list(),
measurement_it1->second.get_ss_list()) ;
@ -122,7 +122,7 @@ public:
std::tr1::unordered_map<std::string, Measurement>::const_iterator
measurement_it1 =
request1.get_measurements().find(i->get_mac_addr()) ;
TS_ASSERT_DIFFERS(request1.get_measurements().end(), measurement_it1) ;
TS_ASSERT(request1.get_measurements().end() != measurement_it1) ;
TS_ASSERT_EQUALS(TestUtil::requests.at(2)->get_measurements().
at(i->get_mac_addr()).get_ss_list(),
measurement_it1->second.get_ss_list()) ;

View File

@ -88,7 +88,7 @@ public:
// !=
AccessPoint ap2 ;
Measurement m3(&ap2) ;
TS_ASSERT_DIFFERS(m1, m3) ;
TS_ASSERT(m1 != m3) ;
// =
m2 = m3 ;

View File

@ -52,7 +52,7 @@ public:
// !=
Mobile mobile3("192.168.0.2", "aa:bb:cc:dd:ee:aa", 6, 38) ;
TS_ASSERT_DIFFERS(mobile2, mobile3) ;
TS_ASSERT(mobile2 != mobile3) ;
// =
mobile2 = mobile3 ;

View File

@ -70,7 +70,7 @@ public:
// !=
Point3D p3(1, 4, 7) ;
TS_ASSERT_DIFFERS(p1, p3) ;
TS_ASSERT(p1 != p3) ;
// =
p2 = p3 ;

View File

@ -67,7 +67,7 @@ public:
// !=
ReferencePoint rp3(1, 4, 7) ;
TS_ASSERT_DIFFERS(rp1, rp3) ;
TS_ASSERT(rp1 != rp3) ;
// =
rp2 = rp3 ;

View File

@ -85,7 +85,7 @@ public:
Measurement meas2 ;
measurements["aa:bb:cc:dd:ee:01"] = meas2 ;
Request r5(&mob1, current_time, measurements) ;
TS_ASSERT_DIFFERS(r4, r5) ;
TS_ASSERT(r4 != r5) ;
// =
r2 = r3 ;

View File

@ -18,7 +18,7 @@ public:
Request request1 ;
Result result4(&request1) ;
TS_ASSERT_DIFFERS(result1, result4) ;
TS_ASSERT(result1 != result4) ;
}
void test_accessors(void)

View File

@ -95,9 +95,9 @@ public:
// The following tests may fail if the ns value is a ms
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp1), current_time) ;
TS_ASSERT_DIFFERS(timestamp1, current_time) ;
TS_ASSERT(timestamp1 != current_time) ;
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp2), current_time) ;
TS_ASSERT_DIFFERS(timestamp2, current_time) ;
TS_ASSERT(timestamp2 != current_time) ;
}
void test_affectation(void)
@ -112,7 +112,7 @@ public:
// struct timespec constructor
Timestamp timestamp1(current_time) ;
TS_ASSERT_DIFFERS(static_cast<struct timespec>(timestamp1), current_time) ;
TS_ASSERT_DIFFERS(timestamp1, current_time) ;
TS_ASSERT(timestamp1 != current_time) ;
// ms constructor
current_time.tv_nsec = current_time.tv_nsec / 1000000 * 1000000 ;
@ -126,7 +126,7 @@ public:
// Affectation
++current_time.tv_sec ;
timestamp2 = current_time ;
TS_ASSERT_DIFFERS(timestamp1, timestamp2) ;
TS_ASSERT(timestamp1 != timestamp2) ;
msec = timestamp2 ;
TS_ASSERT_EQUALS(static_cast<uint64_t>(timestamp2), msec) ;
TS_ASSERT_EQUALS(timestamp2, msec) ;
@ -170,17 +170,17 @@ public:
TS_ASSERT(! (today > today_timespec)) ;
TS_ASSERT(! (today < today_timespec)) ;
TS_ASSERT_DIFFERS(today, yesterday) ;
TS_ASSERT(today != yesterday) ;
TS_ASSERT_LESS_THAN(yesterday, today) ;
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today) ;
TS_ASSERT(! (yesterday > today)) ;
TS_ASSERT(! (yesterday >= today)) ;
TS_ASSERT_DIFFERS(today, yesterday_int) ;
TS_ASSERT(today != yesterday_int) ;
TS_ASSERT_LESS_THAN(yesterday, today_int) ;
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_int) ;
TS_ASSERT(! (yesterday > today_int)) ;
TS_ASSERT(! (yesterday >= today_int)) ;
TS_ASSERT_DIFFERS(today, yesterday_timespec) ;
TS_ASSERT(today != yesterday_timespec) ;
TS_ASSERT_LESS_THAN(yesterday, today_timespec) ;
TS_ASSERT_LESS_THAN_EQUALS(yesterday, today_timespec) ;
TS_ASSERT(! (yesterday > today_timespec)) ;
@ -198,9 +198,9 @@ public:
Timestamp today ;
today.now() ;
TS_ASSERT_DIFFERS(today, zero) ;
TS_ASSERT_DIFFERS(today, zero_timespec) ;
TS_ASSERT_DIFFERS(today, zero_timestamp) ;
TS_ASSERT(today != zero) ;
TS_ASSERT(today != zero_timespec) ;
TS_ASSERT(today != zero_timestamp) ;
today.clear() ;
TS_ASSERT_EQUALS(today, zero) ;

View File

@ -69,7 +69,7 @@ public:
// !=
Waypoint wp3(NULL, 1, 4, 7) ;
TS_ASSERT_DIFFERS(wp1, wp3) ;
TS_ASSERT(wp1 != wp3) ;
// =
wp2 = wp3 ;

View File

@ -51,7 +51,7 @@ public:
// !=
WifiDevice wifidevice3("192.168.0.2", "aa:bb:cc:dd:ee:aa", 6, 38) ;
TS_ASSERT_DIFFERS(wifidevice2, wifidevice3) ;
TS_ASSERT(wifidevice2 != wifidevice3) ;
// =
wifidevice2 = wifidevice3 ;