// 3rd_party_lib:matrix4cj/target/matrix4cj
// 3rd_party_lib_ohos:matrix4cj/target/aarch64-linux-ohos/matrix4cj

package matrix4cj.tests.HLT.LEVEL2

import matrix4cj.*
import std.math.*
import std.unittest.*
import std.unittest.testmacro.*

@Test
public class TestLU {
    @TestCase
    func L2_Test_LU_solve_04(): Unit {
        var matrix01 = Matrix(
            [
                [0.0, 0.0, 0.0, 0.0],
                [0.0, 0.0, 0.0, 0.0],
                [0.0, 0.0, 0.0, 0.0],
                [0.0, 0.0, 0.0, 0.0]
            ]
        )
        var A_Matrix = LUDecomposition(matrix01)
        var B_Matrix = Matrix(
            [
                [1.0, 0.0, 0.0, 0.0],
                [0.0, 1.0, 0.0, 0.0],
                [0.0, 0.0, 1.0, 0.0],
                [0.0, 0.0, 0.0, 1.0]
            ]
        )
        try {
            A_Matrix.solve(B_Matrix)
            @Assert(false)
        } catch (e: Matrix4cjException) {
            if (e.toString().contains("Matrix is singular")) {
                @Assert(true)
            } else {
                @Assert(false)
            }
        }
    }
}