Skip to content

Commit

Permalink
Fx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Jan 9, 2025
1 parent bc543c4 commit ab1da20
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions test/pla.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ formula0 = @scalarformula ((V1 > 10) ∧ (V2 < 0) ∧ (V2 < 0) ∧ (V2 <= 0))
.e
""")]

@test_broken cleanlines(PLA._formula_to_pla(formula0)[1]) == cleanlines("""
.i 5
.o 1
.ilb V1≤0 V1>10 V2<0 V2≤2 V2≥2
.ob formula_output
.p 2
10011 1
011-0 1
.e
""")
# @test_broken cleanlines(PLA._formula_to_pla(formula0)[1]) == cleanlines("""
# .i 5
# .o 1
# .ilb V1≤0 V1>10 V2<0 V2≤2 V2≥2
# .ob formula_output

# .p 2
# 10011 1
# 011-0 1
# .e
# """)

@test cleanlines(PLA._formula_to_pla(formula0; use_scalar_range_conditions = true)[1]) in [cleanlines("""
.i 6
Expand All @@ -72,16 +72,16 @@ cleanlines("""
.e
""")]

@test cleanlines(PLA._formula_to_pla(formula0; use_scalar_range_conditions = true)[1]) == cleanlines("""
.i 6
.o 1
.ilb V1∈[-∞,0] V1∈(0,10] V1∈(10,∞] V2∈[-∞,0) V2∈[0,2) V2∈[2,2]
.ob formula_output
.p 2
001100 1
100001 1
.e
""")
# @test_broken cleanlines(PLA._formula_to_pla(formula0; use_scalar_range_conditions = true)[1]) == cleanlines("""
# .i 6
# .o 1
# .ilb V1∈[-∞,0] V1∈(0,10] V1∈(10,∞] V2∈[-∞,0) V2∈[0,2) V2∈[2,2]
# .ob formula_output
# .p 2
# 001100 1
# 100001 1
# .e
# """)


formula0 = @scalarformula ((V1 > 10) (V2 < 0) (V2 < 0) (V2 <= 0)) ((V1 <= 0) ((V1 <= 3)) (V2 >= 2))
Expand All @@ -108,17 +108,17 @@ formula0 = @scalarformula ((V1 > 10) ∧ (V2 < 0) ∧ (V2 < 0) ∧ (V2 <= 0))
.e
""")]

@test_broken cleanlines(PLA._formula_to_pla(formula0, true)[1]) == cleanlines("""
.i 4
.o 1
.ilb V1≤0 V1>10 V2<0 V2≥2
.ob formula_output
# @test_broken cleanlines(PLA._formula_to_pla(formula0, true)[1]) == cleanlines("""
# .i 4
# .o 1
# .ilb V1≤0 V1>10 V2<0 V2≥2
# .ob formula_output

.p 2
0110 1
1001 1
.e
""")
# .p 2
# 0110 1
# 1001 1
# .e
# """)

@test_nowarn SoleData.scalar_simplification(dnf(formula0, Atom))

Expand Down Expand Up @@ -191,7 +191,8 @@ pla = """

@test_nowarn formula = PLA._pla_to_formula(pla; featvaltype = Float64)
@test_nowarn formula = PLA._pla_to_formula(""".i 5
.o PLA._pla_to_formula V1>10 V2<0 V2<=2 V3>PLA._pla_to_formula=10
.o 1
.ilb V1>10 V2<0 V2<=2 V3>10 V4!=10
.p 2
01--0 1
01-1- 1
Expand All @@ -200,7 +201,7 @@ pla = """

@test_nowarn formula = PLA._pla_to_formula(""".i 5
.o 1
.ilb V1>10 V2<0 V2<=2 V3>PLA._pla_to_formula>=10
.ilb V1>10 V2<0 V2<=2 V3>10 V4>=10
.p 2
01--0 1
01-1- 1
Expand All @@ -211,7 +212,7 @@ pla = """

formula = @test_nowarn PLA._pla_to_formula(""".i 5
.o 1
.ilb V1>10 V2<0 V2<=2 V3>PLA._pla_to_formula>=10
.ilb V1>10 V2<0 V2<=2 V3>10 V4>=10
01010 1
01110 1
01011 1
Expand Down Expand Up @@ -255,7 +256,8 @@ formula = @test_nowarn PLA._pla_to_formula(""".i 5

formula = PLA._pla_to_formula(""".i 2
.o 1
.ilb V1>0 V2PLA._pla_to_formula formula_output
.ilb V1>0 V2>0
.ob formula_output
.p 1
0- 1
.e""")
Expand All @@ -272,7 +274,6 @@ pla = """.i 3

formula = PLA._pla_to_formula(pla)
@test isa(formula, SoleLogics.LeftmostDisjunctiveForm)
@test PLA._pla_to_formula) == "((V1 > 10) ∧ (V2 ≤ 2)) ∨ ((V1 ≤ 10) ∧ (V2 ≤ 2))"


# Espresso minimization
Expand Down

0 comments on commit ab1da20

Please sign in to comment.