Commit 7bea9a7b authored by Cypres TAC's avatar Cypres TAC
Browse files

fix tests to compare unsigned int coming from csv tab

parent 565224f9
Pipeline #228676 passed with stage
in 1 minute and 51 seconds
......@@ -127,12 +127,13 @@ class LocationSpecificPartTest {
.serverAuthorityPublicKey(serverAuthorityKeyPair[1])
.permanentLocationSecretKey(permanentLocationSecretKey).build();
location.setPeriodStartTime(periodStartTime);
location.setQrCodeValidityStartTime(periodStartTime, periodStartTime+120);
/* Encode a LSP with location */
String encryptedLocationSpecificPart = location.getLocationSpecificPartEncryptedBase64();
/* Decode the encoded LSP */
LocationSpecificPart decodedLsp = new LocationSpecificPartDecoder(serverAuthorityKeyPair[0])
.decrypt(encryptedLocationSpecificPart).decodeMessage();
.decrypt(encryptedLocationSpecificPart).decodeMessage();
assertThat(decodedLsp).isEqualTo(lsp);
}
......@@ -209,8 +210,10 @@ class LocationSpecificPartTest {
assertThat(lsp.getVenueCategory1()).isEqualTo(venueCat1);
assertThat(lsp.getVenueCategory2()).isEqualTo(venueCat2);
assertThat(lsp.getCompressedPeriodStartTime()).isEqualTo(periodStartTime);
// TODO: PROBLEM TO SOLVE: int-> long for qrCodeValidityStartTime
// assertThat(lsp.getQrCodeValidityStartTime()).isEqualTo(qrStartTime);
/* Be careful the int qrCodeValidityStartTime is unsigned */
System.out.println("qrCodeValidityStartTime = " + Integer.toUnsignedString(lsp.getQrCodeValidityStartTime()));
int tstQrCodeValidityStartTime = Integer.compareUnsigned(lsp.getQrCodeValidityStartTime(), (int) qrStartTime);
assertThat(tstQrCodeValidityStartTime).isEqualTo(0);
}
/**
......@@ -272,8 +275,10 @@ class LocationSpecificPartTest {
assertThat(decodedLocationContact.getLocationPhone()).isEqualTo(locationPhone);
assertThat(decodedLocationContact.getLocationPin()).isEqualTo(locationPin);
// TODO: PROBLEM TO SOLVE: int-> long for PeriodStartTime
// assertThat(decodedLocationContact.getPeriodStartTime()).isEqualTo(t_periodStart);
/* Be careful the int PeriodStartTime is unsigned */
System.out.println("PeriodStartTime = " + Integer.toUnsignedString(decodedLocationContact.getPeriodStartTime()));
int tstPeriodStartTime = Integer.compareUnsigned(decodedLocationContact.getPeriodStartTime(), (int) t_periodStart);
assertThat(tstPeriodStartTime).isEqualTo(0);
}
@Test
......@@ -308,9 +313,9 @@ class LocationSpecificPartTest {
private String generateRandomDigits(int n) {
String randomNumString = "";
Random r = new Random();
// Generate the first digit from 0-9
/* Generate the first digit from 0-9 */
randomNumString += r.nextInt(10);
// Generate the remaining digits between 0-9
/* Generate the remaining digits between 0-9 */
for (int x = 1; x < n; x++) {
randomNumString += r.nextInt(9);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment