diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 198083f..0603907 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,16 +61,3 @@ jobs: ./arkscript --version mkdir -p std && mv *.ark std/ ./arkscript --lib ./ tests/all.ark - - update-docs: - runs-on: ubuntu-24.04 - name: "Update website documentation" - needs: [ build ] - - steps: - - name: Create repository dispatch event - if: github.ref == 'refs/heads/master' - env: - GITHUB_TOKEN: ${{ secrets.WEBSITE_PUSH_COMMIT_GITHUB_TOKEN }} - run: | - gh api repos/ArkScript-lang/website/dispatches --raw-field event_type=my_update_docs diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..32f69e3 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,18 @@ +name: Update docs + +on: + push: + branches: [ master ] + +jobs: + update-docs: + runs-on: ubuntu-24.04 + name: "Update website documentation" + + steps: + - name: Create repository dispatch event + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.WEBSITE_PUSH_COMMIT_GITHUB_TOKEN }} + run: | + gh api repos/ArkScript-lang/website/dispatches --raw-field event_type=my_update_docs diff --git a/String.ark b/String.ark index b44fbbf..8b28f0f 100644 --- a/String.ark +++ b/String.ark @@ -556,9 +556,9 @@ _edit_distances _i _j - (if (and (< (@ _dist 0) (@ _dist 1)) (< (@ _dist 0) (@ _dist 2))) + (if (and (<= (@ _dist 0) (@ _dist 1)) (<= (@ _dist 0) (@ _dist 2))) (@ _dist 0) - (if (and (< (@ _dist 1) (@ _dist 0)) (< (@ _dist 1) (@ _dist 2))) + (if (and (<= (@ _dist 1) (@ _dist 0)) (<= (@ _dist 1) (@ _dist 2))) (@ _dist 1) (@ _dist 2)))) (set _j (+ 1 _j)) }) diff --git a/tests/string-tests.ark b/tests/string-tests.ark index 2737082..c758ab0 100644 --- a/tests/string-tests.ark +++ b/tests/string-tests.ark @@ -167,5 +167,16 @@ (test:eq (string:levenshteinDistance "arkscript" "arkscript") 0) (test:eq (string:levenshteinDistance "arkscript" "Orkscript") 1) (test:eq (string:levenshteinDistance "arkscript" "0rCscript") 2) - (test:eq (string:levenshteinDistance "arkscript" "OrC") 8) }) -}) + (test:eq (string:levenshteinDistance "arkscript" "OrC") 8) + (test:eq (string:levenshteinDistance "before" "order") 5) + (test:eq (string:levenshteinDistance "time" "system") 5) + (test:eq (string:levenshteinDistance "state" "present") 6) + (test:eq (string:levenshteinDistance "square" "consider") 7) + (test:eq (string:levenshteinDistance "after" "carbohydrate") 10) + (test:eq (string:levenshteinDistance "dictionary" "general") 9) + (test:eq (string:levenshteinDistance "incomprehensible" "public") 14) + (test:eq (string:levenshteinDistance "under" "square") 5) + (test:eq (string:levenshteinDistance "there" "number") 5) + (test:eq (string:levenshteinDistance "there" "never") 4) + (test:eq (string:levenshteinDistance "structure" "interest") 8) + (test:eq (string:levenshteinDistance "possible" "public") 6) }) })