From 307bc295b3493b339d1329814c4737e37bbc1744 Mon Sep 17 00:00:00 2001 From: Jean-Francois Baffier Date: Tue, 26 Mar 2024 12:22:58 +0900 Subject: [PATCH] Doc, CI, coverage (#12) --- .github/workflows/CI.yml | 3 +-- README.md | 10 ++++++---- src/automata.jl | 8 ++++++-- src/diagrams.jl | 23 +++++++++++++---------- src/extrema.jl | 1 + 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ee07bed..5893e45 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,8 +18,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' - - '1.9' + - '1.10' - 'nightly' os: - ubuntu-latest diff --git a/README.md b/README.md index c878ae2..7c860da 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # ConstraintCommons -[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaConstraints.github.io/ConstraintCommons.jl/stable/) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaConstraints.github.io/ConstraintCommons.jl/dev/) +[![JuliaConstraints](https://img.shields.io/badge/docs-Julia_Constraints-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAEpElEQVRYhcWWXWxUVRSF1z53pk7pFClQhJLSgQGjUUGYWgOkpS2hTcWfWBFNNEZDsAX0QV8EHuikPhihKJlgMaM1Gh6MtVZf+ZFOAgRsq1Ki0URaywwibaWUwkz/7j3LhxaDTWemt1rdyX25Z521vuxzs88F/ueSqW70vOuZJSPygCihNvQPna919v03APUwvJ3etyl8FUDK2NthgQTac9p3YjMsO3aG3XxvnvdNCt8Yt9cAsGbW9VnSd6yvyY6frQ54/B6XSlM9ANxxJDd1VGd2+jsHJ+up7AA4XA5vgnAAcDvcjiV2PG0BaKWHk2momFQzZYCOWEc7gN8SSC6197d3TBsA/NAOc54fACdYpX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a8oFLJ1x9+qpsImR3T2zFYAE43wEQ21Vj3U2toM8ikAf5t0AhwTrR+dajgAFIWKTMuUR0B8PW7pshDljzeubPlrKLT6fE4h79VK3UWRn/NaWiJTDZ6ovnqiOdup5B5Tqa6Fc/hTbjB35N/0n3L9CX2f79jwHLzSAAAAAElFTkSuQmCC)](https://JuliaConstraints.github.io/dev/) +[![ConstraintCommons](https://img.shields.io/badge/docs-ConstraintCommons.jl-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAEpElEQVRYhcWWXWxUVRSF1z53pk7pFClQhJLSgQGjUUGYWgOkpS2hTcWfWBFNNEZDsAX0QV8EHuikPhihKJlgMaM1Gh6MtVZf+ZFOAgRsq1Ki0URaywwibaWUwkz/7j3LhxaDTWemt1rdyX25Z521vuxzs88F/ueSqW70vOuZJSPygCihNvQPna919v03APUwvJ3etyl8FUDK2NthgQTac9p3YjMsO3aG3XxvnvdNCt8Yt9cAsGbW9VnSd6yvyY6frQ54/B6XSlM9ANxxJDd1VGd2+jsHJ+up7AA4XA5vgnAAcDvcjiV2PG0BaKWHk2momFQzZYCOWEc7gN8SSC6197d3TBsA/NAOc54fACdYpXNkgR9+6OkDAGVhuP65zK6qHuew1wIwAmDEObzUyuyu6smKfPo8QFsfti2A4u2RZwGmzIwVlGZd+rDH3VWe4e4qz8i69EFParSgFGDKqGaaAEi9U4kELEoVRPaer6mJnq+piUJkr6JUKZEAqXdOGwAoJqmDhHj6ze6Dt173m90HCfGQDIJi2rGc1HkVvvirCyl4Rgz1FhX33DFoNB6py+69XVO6JTJ7yIVysXQ1td6FYXwW+nhx0oE0qQ5IqgoqQ6oBpMPJhvHhAHCkLrsXTrMBgnRRUi2pKjgZ76QA67eF8wGsFi1lIAfNIRW3a+aQEpCDilIGYPXY3n8GoKF3G8A+baACwOFTh3KuxdOOrR3WBioMYJ+G3p3M35FMACLFEtSAco0uvSKp3MVqGVJtFvRLIFqS6eN2wO+nKn4lUiaQLFLtJ611oQOLk/50hA4s7iOtdaSxHwpZxdsiZX4/4+bEPc+i7eFqkFsAZJgWvSeDnt+Thd9e+S93LnAY6BBRvQTqmmoX7ZlINyFZQUVkGcitClYZRa4aDiPNTjgAGA4jjaL+EJplILcWVESWJQUgIG3Ll6cZytoFIEBRJUKeCdVmX7ALEKrNviDkGYoqARAwlLWr/ukf3Rx3VwgAnMvLu9uyrHcArAPgjjnTB85mbnAcXbC513IaD594b8lFuwAAULyjI0eZ6ps1sdjs5bFB00WmArhJQQhQrz/2xcpfpNXnWyTAtwDmjje44Zx5vPBs04aphN+q+k3fHZ+huX6CpR7TsnzS6vMdEqAynkHz3PUvfL5kx+hIFbmu52WfCPnFLKq8uFYEWQBA4nLT+zmnC/10qO5IMcg7AaDkRjT1/tjAJwn4ah0AEk6rq675QZBfUjAISD6uhM8VVoavQLiJwNFRMJQUVoYb1JXwfIo8CPCkEK7rSj2ZsD2CfAcAZyKNQQta2CxQMRCrRLhUgDkUMUGeHutMsQLvI5ghkCghZ7XoGQpICECNFKWAtoSQ2qqDGF4IVgFsdNIsHXCpjaAOgFwx+ujAgEttdNIsJdgIwSqI4YXGR4kbgDZpyc3NU+SpOJ34vj89Pa8oFLJ1x9+qpsImR3T2zFYAE43wEQ21Vj3U2toM8ikAf5t0AhwTrR+dajgAFIWKTMuUR0B8PW7pshDljzeubPlrKLT6fE4h79VK3UWRn/NaWiJTDZ6ovnqiOdup5B5Tqa6Fc/hTbjB35N/0n3L9CX2f79jwHLzSAAAAAElFTkSuQmCC)](https://juliaconstraints.github.io/dev/constraints/constraint_commons) [![Build Status](https://github.com/JuliaConstraints/ConstraintCommons.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaConstraints/ConstraintCommons.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Coverage](https://codecov.io/gh/JuliaConstraints/ConstraintCommons.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaConstraints/ConstraintCommons.jl) -[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) + + +ConstraintCommons.jl is an essential package within the Julia Constraints ecosystem designed to facilitate the development and interoperability of constraint programming solutions in Julia. It serves as a foundational layer that provides shared structures, abstract types, functions, and generic methods utilized by both basic feature packages and learning-oriented packages. diff --git a/src/automata.jl b/src/automata.jl index 5f06c33..bd1e814 100644 --- a/src/automata.jl +++ b/src/automata.jl @@ -53,9 +53,13 @@ end (:e, 0) => :e, ) start = :a - finish = :e - a = Automaton(states, start, finish) + finish_a = :e + finish_b = [:d, :e] + a = Automaton(states, start, finish_a) + b = Automaton(states, start, finish_b) @test accept(a, [0,0,1,1,0,0,1,0,0]) @test !accept(a, [1,1,1,0,1]) + @test accept(b, [0,0,1,1,0,0,1,0,0]) + @test !accept(b, [1,1,1,0,1]) end diff --git a/src/diagrams.jl b/src/diagrams.jl index a22610e..87d6c4b 100644 --- a/src/diagrams.jl +++ b/src/diagrams.jl @@ -25,17 +25,18 @@ function accept(a::MDD, w) return true end -""" - Automaton(a::MDD) +# """ +# Automaton(a::MDD) -Construct an automaton based on a given Multivalued Decision Diagrams (MDD). -""" -function Automaton(a::MDD) - start = first(a.states) - finish = last(a.states) - states = collect(Iterators.flatten(a.states)) - return Automaton(states, start, finish) -end +# Construct an automaton based on a given Multivalued Decision Diagrams (MDD). +# """ +# function Automaton(a::MDD) +# start = first(a.states) +# finish = last(a.states) +# states = Dict(Iterators.flatten(a.states)) +# @info "debug" states start finish +# return Automaton(states, start, finish) +# end # SECTION - Test Items for Automata @testitem "MDD" tags = [:automata, :mdd] begin @@ -57,6 +58,8 @@ end ] a = MDD(states) + # b = Automaton(a) + @test accept(a, [0,2,0]) @test accept(a, [1,2,0]) @test accept(a, [2,0,0]) diff --git a/src/extrema.jl b/src/extrema.jl index 39b981b..2de2faa 100644 --- a/src/extrema.jl +++ b/src/extrema.jl @@ -23,6 +23,7 @@ end # SECTION - Test Items for δ_extrema @testitem "δ_extrema" tags = [:δ_extrema] begin X = map(_ -> rand(1:100,100), 1:3) + @test 0 ≤ δ_extrema(X[1]) ≤ 100 @test 0 ≤ δ_extrema(X[1:2]...) ≤ 100 @test 0 ≤ δ_extrema(X...) ≤ 100