1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 10:49:39 +02:00

Test fine-grained SOP spec version

This commit is contained in:
Paul Schaub 2023-04-14 15:57:29 +02:00
parent 3b1edb076c
commit 926e540016
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 47 additions and 5 deletions

View file

@ -7,6 +7,7 @@ package org.pgpainless.sop;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@ -49,4 +50,26 @@ public class VersionTest {
String firstLine = extendedVersion.split("\n")[0];
assertEquals(sop.version().getName() + " " + sop.version().getVersion(), firstLine);
}
@Test
public void testGetSopSpecVersion() {
boolean incomplete = sop.version().isSopSpecImplementationIncomplete();
int revisionNumber = sop.version().getSopSpecVersionNumber();
String revisionString = sop.version().getSopSpecRevisionString();
assertEquals("draft-dkg-openpgp-stateless-cli-" + String.format("%02d", revisionNumber), revisionString);
String incompletenessRemarks = sop.version().getSopSpecImplementationIncompletenessRemarks();
String fullSopSpecVersion = sop.version().getSopSpecVersion();
if (incomplete) {
assertTrue(fullSopSpecVersion.startsWith("~" + revisionString));
} else {
assertTrue(fullSopSpecVersion.startsWith(revisionString));
}
if (incompletenessRemarks != null) {
assertTrue(fullSopSpecVersion.endsWith(incompletenessRemarks));
}
}
}