Skip to content

Commit

Permalink
Add first standalone unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
J08nY committed Mar 25, 2024
1 parent e8cd86b commit acdb72d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
- name: List libraries
run: env LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/" ./gradlew standalone:run --args="list-libs"

- name: Test
run: ./gradlew test

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions standalone/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ repositories {
dependencies {
implementation(files("$rootDir/ext/wolfcrypt-jni.jar"))
implementation(project(":common"))

testImplementation(platform("org.junit:junit-bom:5.10.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

application {
Expand All @@ -19,6 +23,10 @@ application {
version = "0.3.3"
}

tasks.named<Test>("test") {
useJUnitPlatform()
}

tasks.withType<JavaCompile> {
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
options.compilerArgs.addAll(arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ private KeyAgreementIdent(String name, String... aliases) {
int split = alias.indexOf("with");
this.algo = alias.substring(0, split);
this.kdf = alias.substring(split + 4);
break;
}
}
if (this.algo == null) {
this.algo = name;
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions standalone/src/test/java/cz/crcs/ectester/reader/IdentTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cz.crcs.ectester.reader;

import cz.crcs.ectester.standalone.consts.KeyAgreementIdent;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;
public class IdentTests {
@Test
void kaIdents() {
for (KeyAgreementIdent keyAgreementIdent : KeyAgreementIdent.list()) {
assertNotNull(keyAgreementIdent.getBaseAlgo());
}
}
}

0 comments on commit acdb72d

Please sign in to comment.