Skip to content

Commit

Permalink
fix tests, adjust gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kasimrafique committed Jun 26, 2024
1 parent 3fb50ca commit 937df03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
paths: [src/**]
pull_request:
branches:
- main
Expand All @@ -13,6 +14,8 @@ jobs:
linter:
name: Java Linter
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@
name: Java CI with Maven

on:
paths: [src/**]
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/LA/ComplexNumberTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

Expand Down Expand Up @@ -259,7 +261,7 @@ void multiplicativeInverse_realNumber() {
ComplexNumber z = ComplexNumber.rectangular(2, 0); // Complex number 2
ComplexNumber result = z.multiplicativeInverse().orElseThrow();

assertEquals(ComplexNumber.rectangular(0.5, 0), result);
assertEquals(ComplexNumber.rectangular(0.5, -0.0), result);
}

@Test
Expand All @@ -275,7 +277,7 @@ void multiplicativeInverse_complexNumber() {
void multiplicativeInverse_zero() {
ComplexNumber z = ComplexNumber.rectangular(0, 0); // Complex number 0

assertThrows(IllegalArgumentException.class, z::multiplicativeInverse);
assertEquals(Optional.empty(), z.multiplicativeInverse());
}

@Test
Expand Down

0 comments on commit 937df03

Please sign in to comment.