From 68f459908fb587267813029c94138d794d26940b Mon Sep 17 00:00:00 2001 From: Roger-Luo Date: Fri, 30 Apr 2021 18:58:34 -0400 Subject: [PATCH] fix lhs rhs cmp --- src/tools.jl | 2 +- test/runtests.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools.jl b/src/tools.jl index 8120819..51d0d1e 100644 --- a/src/tools.jl +++ b/src/tools.jl @@ -64,7 +64,7 @@ end function cmp_exp(lhs, rhs) @switch (lhs, rhs) begin - @case (Neg(a::Token{:float64}), b::Token{:float64}) + @case (Neg(a::Token{:float64}), b::Token{:float64}) || (b::Token{:float64}, Neg(a::Token{:float64})) startswith(b.str, '-') && a.str == b.str[2:end] @case _ cmp_ast(lhs, rhs) diff --git a/test/runtests.jl b/test/runtests.jl index 2a53a31..ae234c1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,6 +7,7 @@ using Test @testset "cmp_exp" begin @test cmp_exp(Neg(qasm_f64(0.2)), qasm_f64(-0.2)) + @test cmp_exp(qasm_f64(-0.2), Neg(qasm_f64(0.2))) end @testset "conversion" begin