From b06eadc7d8d28bc16faa05b9a4478b71f42b119c Mon Sep 17 00:00:00 2001 From: Gabe Appleton Date: Wed, 25 Sep 2019 21:32:55 -0700 Subject: [PATCH 001/326] Badges refer to master on master --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3afecb71..a493ee5c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # gappleto97's Project Euler solutions -Windows testing[¹](#footnotes): [![Windows build status](https://ci.appveyor.com/api/projects/status/lqi44hqr7jgqjwpy/branch/dev?svg=true)](https://ci.appveyor.com/project/gappleto97/euler) Linux testing[²](#footnotes): [![Linux build status](https://api.shippable.com/projects/5d7ab0a9686e0a0007cb5970/badge?branch=dev)](https://app.shippable.com/github/gappleto97/Euler/dashboard) OSX testing[³](#footnotes): [![OSX build status](https://travis-ci.org/gappleto97/Euler.svg?branch=dev)](https://travis-ci.org/gappleto97/Euler) +Windows testing[¹](#footnotes): [![Windows build status](https://ci.appveyor.com/api/projects/status/lqi44hqr7jgqjwpy/branch/master?svg=true)](https://ci.appveyor.com/project/gappleto97/euler) Linux testing[²](#footnotes): [![Linux build status](https://api.shippable.com/projects/5d7ab0a9686e0a0007cb5970/badge?branch=master)](https://app.shippable.com/github/gappleto97/Euler/dashboard) OSX testing[³](#footnotes): [![OSX build status](https://travis-ci.org/gappleto97/Euler.svg?branch=master)](https://travis-ci.org/gappleto97/Euler) This is the repository I keep for prospective employers to look at project Euler code that I have written. From e72b76133edef5502b3cbc788c4c9ab420933526 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:43:31 +0000 Subject: [PATCH 002/326] Bump y18n from 4.0.0 to 4.0.1 in /javascript Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] --- javascript/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/package-lock.json b/javascript/package-lock.json index fe6bc227..0bee8643 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -1490,9 +1490,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==" }, "yargs": { "version": "13.2.2", From 9a05d58792058c2c6cfd91609299358f9e9daf3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:49:28 +0000 Subject: [PATCH 003/326] Bump lodash from 4.17.15 to 4.17.21 in /javascript Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.21) Signed-off-by: dependabot[bot] --- javascript/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/package-lock.json b/javascript/package-lock.json index fe6bc227..b93250cc 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -846,9 +846,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "log-symbols": { "version": "2.2.0", From 00c43c8cec4e58a1b9bc32203547ba7b185c8f93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Jun 2021 10:02:28 +0000 Subject: [PATCH 004/326] Bump glob-parent from 5.0.0 to 5.1.2 in /javascript Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.0.0 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] --- javascript/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/package-lock.json b/javascript/package-lock.json index fe6bc227..062a5469 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -594,9 +594,9 @@ } }, "glob-parent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz", - "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" From 80e1ea7a705528258897c6057e8e84138da24425 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Feb 2022 14:16:03 +0000 Subject: [PATCH 005/326] Bump ajv from 6.10.2 to 6.12.6 in /javascript Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.10.2 to 6.12.6. - [Release notes](https://github.com/ajv-validator/ajv/releases) - [Commits](https://github.com/ajv-validator/ajv/compare/v6.10.2...v6.12.6) --- updated-dependencies: - dependency-name: ajv dependency-type: indirect ... Signed-off-by: dependabot[bot] --- javascript/package-lock.json | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/javascript/package-lock.json b/javascript/package-lock.json index fe6bc227..e624c695 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -37,15 +37,23 @@ "dev": true }, "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", + "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" + }, + "dependencies": { + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + } } }, "ansi-colors": { @@ -482,12 +490,6 @@ "tmp": "^0.0.33" } }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", From bffce7872729f092297ece148967e8c4990aadee Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 1 Mar 2024 16:37:08 -0500 Subject: [PATCH 006/326] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2a41242..68f19242 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# gappleto97's Project Euler solutions +# LivInTheLookingGlass's Project Euler solutions Windows testing[¹](#footnotes): [![Windows build status](https://ci.appveyor.com/api/projects/status/lqi44hqr7jgqjwpy/branch/master?svg=true)](https://ci.appveyor.com/project/gappleto97/euler) Linux testing[²](#footnotes): [![Linux build status](https://api.shippable.com/projects/5d7ab0a9686e0a0007cb5970/badge?branch=master)](https://app.shippable.com/github/gappleto97/Euler/dashboard) OSX testing[³](#footnotes): [![OSX build status](https://travis-ci.org/gappleto97/Euler.svg?branch=master)](https://travis-ci.org/gappleto97/Euler) From 973947a576bdfca9c826e7f652d091efa5e1bc20 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 17 Jun 2024 23:09:23 -0500 Subject: [PATCH 007/326] Attempt to migrate to github actions --- .github/workflows/on_push.yml | 76 +++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/on_push.yml diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml new file mode 100644 index 00000000..fe9dbd22 --- /dev/null +++ b/.github/workflows/on_push.yml @@ -0,0 +1,76 @@ +name: Euler Regression Check + +on: push + +jobs: + python: + strategy: + matrix: + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "graalpy-23.1", "graalpy-24.0"] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Use Python ${{ matrix.version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.version }} + + - name: Run tests + run: make pytest + + javascript: + strategy: + matrix: + version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.version }} + + - name: Run tests + run: make jstest + + c: + strategy: + matrix: + compiler: ["llvm", "gcc"] + # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: windows-latest + compiler: msvc + - os: windows-latest + compiler: mingw + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Use Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} + with: + compiler: ${{ matrix.compiler }} + + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + if: ${{ matrix.compiler == 'mingw' }} + with: + platform: x64 + + - name: Run tests + run: make ctest From 3e08850e261cc146b99626afdbfdaeb2f74201c1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 17 Jun 2024 23:59:32 -0500 Subject: [PATCH 008/326] Remove pytest version requirements --- c/requirements.txt | 2 +- python/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c/requirements.txt b/c/requirements.txt index 29a8fb75..484438c7 100644 --- a/c/requirements.txt +++ b/c/requirements.txt @@ -1,4 +1,4 @@ -pytest>=4.4.0,<5 +pytest pytest-benchmark sortedcontainers u-msgpack-python diff --git a/python/requirements.txt b/python/requirements.txt index 220f8da8..9f25900f 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,5 +1,5 @@ u-msgpack-python -pytest>=4.4.0,<5 +pytest sortedcontainers pytest-benchmark pytest-mypy From 38e78ea38dfe9c70135997cdef481b190f6b1d74 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:06:26 -0500 Subject: [PATCH 009/326] Try only Python, macos-13 (for x64) --- .github/workflows/on_push.yml | 90 +++++++++++++++++------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index fe9dbd22..494942b8 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "graalpy-23.1", "graalpy-24.0"] - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-13] runs-on: ${{ matrix.os }} steps: @@ -21,56 +21,56 @@ jobs: - name: Run tests run: make pytest - javascript: - strategy: - matrix: - version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] - os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} +# javascript: +# strategy: +# matrix: +# version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] +# os: [ubuntu-latest, windows-latest, macos-latest] +# runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 +# steps: +# - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.version }} +# - name: Use Node.js ${{ matrix.version }} +# uses: actions/setup-node@v3 +# with: +# node-version: ${{ matrix.version }} - - name: Run tests - run: make jstest +# - name: Run tests +# run: make jstest - c: - strategy: - matrix: - compiler: ["llvm", "gcc"] - # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, - os: [ubuntu-latest, windows-latest, macos-latest] - include: - - os: windows-latest - compiler: msvc - - os: windows-latest - compiler: mingw - runs-on: ${{ matrix.os }} +# c: +# strategy: +# matrix: +# compiler: ["llvm", "gcc"] +# # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, +# os: [ubuntu-latest, windows-latest, macos-latest] +# include: +# - os: windows-latest +# compiler: msvc +# - os: windows-latest +# compiler: mingw +# runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 +# steps: +# - uses: actions/checkout@v3 - - name: Use Python 3.7 - uses: actions/setup-python@v5 - with: - python-version: 3.7 +# - name: Use Python 3.7 +# uses: actions/setup-python@v5 +# with: +# python-version: 3.7 - - name: Setup Cpp - uses: aminya/setup-cpp@v1 - if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} - with: - compiler: ${{ matrix.compiler }} +# - name: Setup Cpp +# uses: aminya/setup-cpp@v1 +# if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} +# with: +# compiler: ${{ matrix.compiler }} - - name: Set up MinGW - uses: egor-tensin/setup-mingw@v2 - if: ${{ matrix.compiler == 'mingw' }} - with: - platform: x64 +# - name: Set up MinGW +# uses: egor-tensin/setup-mingw@v2 +# if: ${{ matrix.compiler == 'mingw' }} +# with: +# platform: x64 - - name: Run tests - run: make ctest +# - name: Run tests +# run: make ctest From 5d62356bdce00b1650fd38f67cf813f8e11b124f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:08:28 -0500 Subject: [PATCH 010/326] Disable fail-fast --- .github/workflows/on_push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 494942b8..7112ef5f 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -5,6 +5,7 @@ on: push jobs: python: strategy: + fail-fast: false matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "graalpy-23.1", "graalpy-24.0"] os: [ubuntu-latest, windows-latest, macos-13] From 657485313ad3e616c4a8f4cc12f6af8184ded7bf Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:25:58 -0500 Subject: [PATCH 011/326] Enable JavaScript again --- .github/workflows/on_push.yml | 42 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 7112ef5f..f6bc332d 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -9,6 +9,16 @@ jobs: matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "graalpy-23.1", "graalpy-24.0"] os: [ubuntu-latest, windows-latest, macos-13] + exclude: + - os: ubuntu-latest + version: 3.6 + - os: macos-13 + version: [3.11, 3.12] + include: + - os: ubuntu-20.04 + version: 3.6 + - os: macos-latest + version: [3.11, 3.12] runs-on: ${{ matrix.os }} steps: @@ -22,26 +32,28 @@ jobs: - name: Run tests run: make pytest -# javascript: -# strategy: -# matrix: -# version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] -# os: [ubuntu-latest, windows-latest, macos-latest] -# runs-on: ${{ matrix.os }} + javascript: + strategy: + fail-fast: false + matrix: + version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 -# - name: Use Node.js ${{ matrix.version }} -# uses: actions/setup-node@v3 -# with: -# node-version: ${{ matrix.version }} + - name: Use Node.js ${{ matrix.version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.version }} -# - name: Run tests -# run: make jstest + - name: Run tests + run: make jstest # c: # strategy: +# fail-fast: false # matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, @@ -61,7 +73,7 @@ jobs: # with: # python-version: 3.7 -# - name: Setup Cpp +# - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 # if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} # with: From af85f359a5e9bd35d84481caec33fa1dea2a1f50 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:35:09 -0500 Subject: [PATCH 012/326] Disable flake8 checks (seems broken) --- .github/workflows/on_push.yml | 2 +- python/Makefile | 6 +++--- python/requirements.txt | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index f6bc332d..750c4a3c 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -30,7 +30,7 @@ jobs: python-version: ${{ matrix.version }} - name: Run tests - run: make pytest + run: LINT=FALSE make pytest javascript: strategy: diff --git a/python/Makefile b/python/Makefile index a364e374..7696be36 100644 --- a/python/Makefile +++ b/python/Makefile @@ -12,12 +12,12 @@ ifeq ($(LINT),false) pytest_args?= -vl --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose else ifeq ($(LINT),true) -pytest_args?= -vl --mypy --mypy-ignore-missing-imports --flake8 --isort -k 'not test_problem and not test_is_prime and not test_groupwise' +pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort -k 'not test_problem and not test_is_prime and not test_groupwise' else ifeq ($(LINT),less) -pytest_args?= -vl --flake8 --isort --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose +pytest_args?= -vl --isort --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose else -pytest_args?= -vl --mypy --mypy-ignore-missing-imports --flake8 --isort --benchmark-min-time=0.05 --benchmark-group-by=fullfunc --benchmark-sort=fullname --benchmark-verbose +pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort --benchmark-min-time=0.05 --benchmark-group-by=fullfunc --benchmark-sort=fullname --benchmark-verbose endif endif endif diff --git a/python/requirements.txt b/python/requirements.txt index 9f25900f..50bb4abc 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -3,6 +3,5 @@ pytest sortedcontainers pytest-benchmark pytest-mypy -pytest-flake8 pytest-isort pytest-xdist From 69c991d91d171cf6c74e241bc8ea7a4046179abc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:38:25 -0500 Subject: [PATCH 013/326] Fix some workflow errors --- .github/workflows/on_push.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 750c4a3c..48f008a3 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -30,7 +30,7 @@ jobs: python-version: ${{ matrix.version }} - name: Run tests - run: LINT=FALSE make pytest + run: make pytest LINT=FALSE javascript: strategy: @@ -38,6 +38,12 @@ jobs: matrix: version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] os: [ubuntu-latest, windows-latest, macos-latest] + exclude: + - os: macos-latest + version: [8, 9, 10, 11, 12, 13, 14, 15] + include: + - os: macos-13 + version: [8, 9, 10, 11, 12, 13, 14, 15] runs-on: ${{ matrix.os }} steps: From 04c397dab2b6f367b28ef9ea887de960a5199c73 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 00:42:47 -0500 Subject: [PATCH 014/326] Fix some workflow errors --- .github/workflows/on_push.yml | 40 +++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 48f008a3..9788761c 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -13,12 +13,16 @@ jobs: - os: ubuntu-latest version: 3.6 - os: macos-13 - version: [3.11, 3.12] + version: 3.11 + - os: macos-13 + version: 3.12 include: - os: ubuntu-20.04 version: 3.6 - os: macos-latest - version: [3.11, 3.12] + version: 3.11 + - os: macos-latest + version: 3.12 runs-on: ${{ matrix.os }} steps: @@ -40,10 +44,38 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] exclude: - os: macos-latest - version: [8, 9, 10, 11, 12, 13, 14, 15] + version: 8 + - os: macos-latest + version: 9 + - os: macos-latest + version: 10 + - os: macos-latest + version: 11 + - os: macos-latest + version: 12 + - os: macos-latest + version: 13 + - os: macos-latest + version: 14 + - os: macos-latest + version: 15 include: - os: macos-13 - version: [8, 9, 10, 11, 12, 13, 14, 15] + version: 8 + - os: macos-13 + version: 9 + - os: macos-13 + version: 10 + - os: macos-13 + version: 11 + - os: macos-13 + version: 12 + - os: macos-13 + version: 13 + - os: macos-13 + version: 14 + - os: macos-13 + version: 15 runs-on: ${{ matrix.os }} steps: From dec82062a082e2a524e20bc71cba59f0a9e253d0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 01:23:11 -0500 Subject: [PATCH 015/326] Disable automatic mypy checks because of error below error: Source file found twice under different module names: "python.p0003" and "p0003" --- .github/workflows/on_push.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 9788761c..0fd72858 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "graalpy-23.1", "graalpy-24.0"] + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] os: [ubuntu-latest, windows-latest, macos-13] exclude: - os: ubuntu-latest @@ -23,6 +23,10 @@ jobs: version: 3.11 - os: macos-latest version: 3.12 + - os: ubuntu-latest + version: graalpy-23.1 + - os: ubuntu-latest + version: graalpy-24.0 runs-on: ${{ matrix.os }} steps: @@ -34,7 +38,7 @@ jobs: python-version: ${{ matrix.version }} - name: Run tests - run: make pytest LINT=FALSE + run: make pytest LINT=false javascript: strategy: From 7b6e8abe3de18c0737d5241de39177b2cd687973 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 13 May 2024 14:49:41 -0500 Subject: [PATCH 016/326] Move mypy to purely linux --- .github/workflows/on_push.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 0fd72858..5db25833 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest, macos-13] exclude: - os: ubuntu-latest @@ -27,6 +27,16 @@ jobs: version: graalpy-23.1 - os: ubuntu-latest version: graalpy-24.0 + - os: ubuntu-latest + version: pypy3.6 + - os: ubuntu-latest + version: pypy3.7 + - os: ubuntu-latest + version: pypy3.8 + - os: ubuntu-latest + version: pypy3.9 + - os: ubuntu-latest + version: pypy3.10 runs-on: ${{ matrix.os }} steps: From da9facc580d195be4fde9cae5ef669b4fc745aa5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 21:53:54 -0500 Subject: [PATCH 017/326] remove old pypy versions --- .github/workflows/on_push.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 5db25833..ca7b4a05 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -27,10 +27,6 @@ jobs: version: graalpy-23.1 - os: ubuntu-latest version: graalpy-24.0 - - os: ubuntu-latest - version: pypy3.6 - - os: ubuntu-latest - version: pypy3.7 - os: ubuntu-latest version: pypy3.8 - os: ubuntu-latest From 9a7862f58b4b4fcc0d1f181c72fa1e6d71ecc779 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 18 Jun 2024 22:19:29 -0500 Subject: [PATCH 018/326] enable c --- .github/workflows/on_push.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index ca7b4a05..e1d34869 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -99,27 +99,27 @@ jobs: - name: Run tests run: make jstest -# c: -# strategy: -# fail-fast: false -# matrix: + c: + strategy: + fail-fast: false + matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, -# os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest, macos-13] # include: # - os: windows-latest # compiler: msvc # - os: windows-latest # compiler: mingw -# runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 -# - name: Use Python 3.7 -# uses: actions/setup-python@v5 -# with: -# python-version: 3.7 + - name: Use Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: 3.7 # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 @@ -133,5 +133,5 @@ jobs: # with: # platform: x64 -# - name: Run tests -# run: make ctest + - name: Run tests + run: make ctest From 97b0beeb91756f1038babd29f71f3a0e8ba4fa9f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 18:12:39 -0500 Subject: [PATCH 019/326] Begin conversion to Unity tests --- .gitmodules | 3 +++ c/Unity | 1 + c/p0000_template.c | 7 ++++- c/p0001.c | 7 +++-- c/test.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 c/Unity create mode 100644 c/test.c diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..31ed99f1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "c/Unity"] + path = c/Unity + url = https://github.com/ThrowTheSwitch/Unity diff --git a/c/Unity b/c/Unity new file mode 160000 index 00000000..18fb3392 --- /dev/null +++ b/c/Unity @@ -0,0 +1 @@ +Subproject commit 18fb33921f1bb973c81a9ce740c52b92a152333d diff --git a/c/p0000_template.c b/c/p0000_template.c index 3ad8066e..dcd75604 100644 --- a/c/p0000_template.c +++ b/c/p0000_template.c @@ -9,9 +9,14 @@ This paragraph should be replaced by the problem description, excluding images. */ #include +unsigned long long p0000() { + return 0; +} +#ifndef UNITY_END int main(int argc, char const *argv[]) { - unsigned long long answer = 0; + unsigned long long answer = p0000(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0001.c b/c/p0001.c index d092e5d7..025cba5d 100644 --- a/c/p0001.c +++ b/c/p0001.c @@ -16,8 +16,7 @@ Find the sum of all the multiples of 3 or 5 below 1000. #include #include "include/iterator.h" -int main(int argc, char const *argv[]) { - unsigned long long answer = 0; +unsigned long long p0001() { counter c = counter3(0, 1000, 3); while (!c.exhausted) { answer += next(c); @@ -30,6 +29,10 @@ int main(int argc, char const *argv[]) { while (!c.exhausted) { answer -= next(c); } +} + +int main(int argc, char const *argv[]) { + unsigned long long answer = p0001(); printf("%llu\n", answer); return 0; } diff --git a/c/test.c b/c/test.c new file mode 100644 index 00000000..908d2da0 --- /dev/null +++ b/c/test.c @@ -0,0 +1,66 @@ +#include "Unity/src/unity.h" +#include "p0001.c" +#include "p0002.c" +#include "p0003.c" +#include "p0004.c" +#include "p0005.c" +#include "p0006.c" +#include "p0007.c" +#include "p0008.c" +#include "p0009.c" +#include "p0010.c" +#include "p0011.c" +#include "p0012.c" +#include "p0013.c" +#include "p0014.c" +#include "p0015.c" +#include "p0016.c" +#include "p0034.c" +#include "p0076.c" + +typedef struct { + unsigned int id; + uint64_t answer; + void * func; +} Answer; + +static const Answer[] answers = { + {1, 1, p0001}, + {2, 1, p0002}, + {3, 1, p0003}, + {4, 1, p0004}, + {5, 1, p0005}, + {6, 1, p0006}, + {7, 1, p0007}, + {8, 1, p0008}, + {9, 1, p0009}, + {10, 1, p0010}, + {11, 1, p0011}, + {12, 1, p0012}, + {13, 1, p0013}, + {14, 1, p0014}, + {15, 1, p0015}, + {16, 1, p0016}, + {34, 1, p0034}, + {76, 1, p0076}, +}; + +void setUp(void) { + // set stuff up here +} + +void tearDown(void) { + // clean stuff up here +} + +TEST_RANGE(0, sizeof(answers) / sizeof(answers[0]), 1) +void test_euler_answer(size_t index) { + Answer key = answers[index]; + TEST_ASSERT_EQUAL_INT64(key.answer, key.func()) +} + +int main(void) { + UNITY_BEGIN(); + RUN_TEST(test_function_should_doAlsoDoBlah); + return UNITY_END(); +} From 4b2ccef14f5d86dbd7f1654929546bd8d5dc8031 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 20:46:26 -0500 Subject: [PATCH 020/326] Convert to unity testing --- c/include/bcd.h | 20 ++++++++++++++ c/p0000_template.c | 1 + c/p0001.c | 6 ++++- c/p0002.c | 10 ++++++- c/p0003.c | 10 ++++++- c/p0004.c | 10 +++++-- c/p0005.c | 10 ++++++- c/p0006.c | 13 +++++++--- c/p0007.c | 16 ++++++++---- c/p0008.c | 11 ++++++-- c/p0009.c | 11 ++++++-- c/p0010.c | 13 +++++++--- c/p0011.c | 11 ++++++-- c/p0012.c | 18 ++++++++----- c/p0013.c | 15 ++++++++--- c/p0014.c | 11 ++++++-- c/p0015.c | 9 +++++-- c/p0016.c | 11 ++++++-- c/p0034.c | 10 ++++++- c/p0076.c | 11 ++++++-- c/test.c | 65 ++++++++++++++++++++++++++-------------------- 21 files changed, 223 insertions(+), 69 deletions(-) diff --git a/c/include/bcd.h b/c/include/bcd.h index e7a9a1d9..2fdf4171 100644 --- a/c/include/bcd.h +++ b/c/include/bcd.h @@ -1,3 +1,4 @@ +#pragma once #include #include #include @@ -538,6 +539,25 @@ inline BCD_int shift_bcd_right(BCD_int a, uintmax_t tens) { return div_bcd_pow_10(a, tens); } +uintmax_t bcd_to_unsigned(BCD_int a) { + if (a.zero) + return 0; + uintmax_t answer = 0; + for (size_t i = 0; i < a.bcd_digits; ++i) { + size_t digit = a.bcd_digits - i - 1; + answer = answer * 100 + ((a.digits[digit] & 0xF0) >> 4) * 10 + (a.digits[digit] & 0xF); + } + return answer; +} + +uintmax_t bcd_to_signed(BCD_int a); +inline uintmax_t bcd_to_signed(BCD_int a) { + uintmax_t answer = bcd_to_unsigned(a); + if (a.negative) + return -answer; + return answer; +} + void print_bcd(BCD_int x) { if (unlikely(x.zero)) { printf("0"); diff --git a/c/p0000_template.c b/c/p0000_template.c index dcd75604..937fbc22 100644 --- a/c/p0000_template.c +++ b/c/p0000_template.c @@ -7,6 +7,7 @@ critque. This paragraph should be replaced by the problem description, excluding images. */ +#pragma once #include unsigned long long p0000() { diff --git a/c/p0001.c b/c/p0001.c index 025cba5d..205f074c 100644 --- a/c/p0001.c +++ b/c/p0001.c @@ -12,11 +12,12 @@ get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. */ - +#pragma once #include #include "include/iterator.h" unsigned long long p0001() { + unsigned long long answer = 0; counter c = counter3(0, 1000, 3); while (!c.exhausted) { answer += next(c); @@ -29,10 +30,13 @@ unsigned long long p0001() { while (!c.exhausted) { answer -= next(c); } + return answer; } +#ifndef UNITY_END int main(int argc, char const *argv[]) { unsigned long long answer = p0001(); printf("%llu\n", answer); return 0; } +#endif diff --git a/c/p0002.c b/c/p0002.c index 71139c3e..7f014ab4 100644 --- a/c/p0002.c +++ b/c/p0002.c @@ -14,10 +14,11 @@ By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. */ +#pragma once #include #include "include/fibonacci.h" -int main(int argc, char const *argv[]) { +unsigned long long p0002() { unsigned long long answer = 0; fibonacci fib = fibonacci1(3999999); while (!fib.exhausted) { @@ -25,6 +26,13 @@ int main(int argc, char const *argv[]) { next(fib); // odd (1, 5, 21, 89, ...) answer += next(fib); // even (2, 8, 34, 144, ...) } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0002(); printf("%llu\n", answer); return 0; } +#endif diff --git a/c/p0003.c b/c/p0003.c index a3c708e4..449f2fee 100644 --- a/c/p0003.c +++ b/c/p0003.c @@ -11,16 +11,24 @@ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? */ +#pragma once #include #include "include/primes.h" -int main(int argc, char const *argv[]) { +unsigned long long p0003() { unsigned long long answer = 0; prime_factor_counter pfc = prime_factors(600851475143); while (!pfc.exhausted) { answer = next(pfc); } free_prime_factor_counter(pfc); + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0003(); printf("%llu\n", answer); return 0; } +#endif diff --git a/c/p0004.c b/c/p0004.c index d88f6eb1..54c0c865 100644 --- a/c/p0004.c +++ b/c/p0004.c @@ -10,12 +10,12 @@ the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. */ +#pragma once #include #include "include/digits.h" - -int main(int argc, char const *argv[]) { +unsigned int p0004() { unsigned int answer = 0, i, j, a, z, prod; bool broken; digit_counter dc; @@ -36,6 +36,12 @@ int main(int argc, char const *argv[]) { free_digit_counter(dc); } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { printf("%u", answer); return 0; } +#endif diff --git a/c/p0005.c b/c/p0005.c index e1c6d3e7..e342980d 100644 --- a/c/p0005.c +++ b/c/p0005.c @@ -12,11 +12,12 @@ number infrastructure a lot easier to set up. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? */ +#pragma once #include #include "include/macros.h" #include "include/primes.h" -int main(int argc, char const *argv[]) { +unsigned long long p0005() { unsigned long long answer = 1; unsigned char factor_tracker[20] = {0}, local_factor_tracker[20] = {0}; prime_factor_counter pfc; @@ -36,6 +37,13 @@ int main(int argc, char const *argv[]) { answer *= i; } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0005(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0006.c b/c/p0006.c index 1f8d9285..d618b55c 100644 --- a/c/p0006.c +++ b/c/p0006.c @@ -19,14 +19,21 @@ numbers and the square of the sum is 3025 − 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. */ +#pragma once #include - -int main(int argc, char const *argv[]) { +unsigned long long p0006() { unsigned long long sum = 100 * 101 / 2, sum_of_squares = 0; for (unsigned long long i = 1; i < 101; i++) { sum_of_squares += i * i; } - printf("%llu", sum * sum - sum_of_squares); + return sum * sum - sum_of_squares; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0006(); + printf("%llu", answer); return 0; } +#endif diff --git a/c/p0007.c b/c/p0007.c index ffe3865c..cc955ccb 100644 --- a/c/p0007.c +++ b/c/p0007.c @@ -9,20 +9,26 @@ By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that What is the 10 001st prime number? */ +#pragma once #include #include "include/primes.h" - -int main(int argc, char const *argv[]) { +unsigned long long p0007() { unsigned int answer, count = 0; prime_sieve ps = prime_sieve0(); while (!ps.exhausted) { answer = next(ps); - if (++count == 10001) { - printf("%u", answer); + if (++count == 10001) break; - } } free_prime_sieve(ps); + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0007(); + printf("%llu", answer); return 0; } +#endif diff --git a/c/p0008.c b/c/p0008.c index 5329fb8a..b28973aa 100644 --- a/c/p0008.c +++ b/c/p0008.c @@ -30,11 +30,11 @@ The four adjacent digits in the 1000-digit number that have the greatest product Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? */ +#pragma once #include #include "include/macros.h" - -int main(int argc, char const *argv[]) { +unsigned long long p0008() { size_t i, j; unsigned long long answer = 0, tmp; const char *plain_digits = ("73167176531330624919225119674426574742355349194934" @@ -68,6 +68,13 @@ int main(int argc, char const *argv[]) { } answer = max(answer, tmp); } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0008(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0009.c b/c/p0009.c index 6c0c0f5a..5bd4d036 100644 --- a/c/p0009.c +++ b/c/p0009.c @@ -13,10 +13,10 @@ For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ +#pragma once #include - -int main(int argc, char const *argv[]) { +unsigned long long p0009() { unsigned long long answer = 0; for (unsigned int c = 3; !answer && c < 1000; c++) { for (unsigned int b = 2; b < c; b++) { @@ -27,6 +27,13 @@ int main(int argc, char const *argv[]) { } } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0009(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0010.c b/c/p0010.c index 65903215..d09f4baa 100644 --- a/c/p0010.c +++ b/c/p0010.c @@ -9,17 +9,24 @@ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. */ +#pragma once #include #include "include/primes.h" - -int main(int argc, char const *argv[]) { +unsigned long long p0010() { unsigned long long tmp, answer = 0; prime_sieve ps = prime_sieve0(); while ((tmp = next(ps)) < 2000000) { answer += tmp; } free_prime_sieve(ps); - printf("%llu", answer); // this is because of a bug + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0010(); + printf("%llu", answer); return 0; } +#endif diff --git a/c/p0011.c b/c/p0011.c index d9a62a28..f2b1e29f 100644 --- a/c/p0011.c +++ b/c/p0011.c @@ -31,6 +31,7 @@ The product of these numbers is 26 × 63 × 78 × 14 = 1788696. What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid? */ +#pragma once #include #include "include/macros.h" @@ -57,8 +58,7 @@ static const unsigned char grid[20][20] = { { 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48} }; - -int main(int argc, char const *argv[]) { +unsigned long long p0011() { unsigned long answer = 0, tmp; unsigned char i, j; for (i = 0; i < 20; i++) { @@ -81,6 +81,13 @@ int main(int argc, char const *argv[]) { answer = max(answer, tmp); } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0011(); printf("%lu", answer); return 0; } +#endif diff --git a/c/p0012.c b/c/p0012.c index d76a1fbd..d836264d 100644 --- a/c/p0012.c +++ b/c/p0012.c @@ -26,6 +26,7 @@ We can see that 28 is the first triangle number to have over five divisors. What is the value of the first triangle number to have over five hundred divisors? */ +#pragma once #include #include "include/factors.h" @@ -51,16 +52,21 @@ triangle_iterator triangle_iterator0() { return ret; } -int main(int argc, char const *argv[]) { +unsigned long long p0012() { triangle_iterator ti = triangle_iterator0(); unsigned long long current; while (true) { current = next(ti); // printf("%llu\n", current); - if (proper_divisor_count(current) > 499) { - printf("%llu", current); - return 0; - } + if (proper_divisor_count(current) > 499) + return current; } - return -1; } + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0012(); + printf("%llu", answer); + return 0; +} +#endif diff --git a/c/p0013.c b/c/p0013.c index 8d4188f0..195f0555 100644 --- a/c/p0013.c +++ b/c/p0013.c @@ -108,6 +108,7 @@ Work out the first ten digits of the sum of the following one-hundred 50-digit n 20849603980134001723930671666823555245252804609722 53503534226472524250874054075591789781264330331690 */ +#pragma once #include #include "include/bcd.h" @@ -215,9 +216,9 @@ static const char numbers[100][50] = { "53503534226472524250874054075591789781264330331690" }; - -int main(int argc, char const *argv[]) { +unsigned long long p0013() { BCD_int answer, tmp1, tmp2 = new_BCD_int(0, false); + uintmax_t ret; for (size_t i = 0; i < 100; i++) { tmp1 = BCD_from_ascii(numbers[i], 50, false); answer = add_bcd(tmp1, tmp2); @@ -227,7 +228,15 @@ int main(int argc, char const *argv[]) { } answer = div_bcd_pow_10(tmp2, tmp2.decimal_digits - 10); free_BCD_int(tmp2); - print_bcd(answer); + ret = bcd_to_unsigned(answer); free_BCD_int(answer); + return ret; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + BCD_int answer = p0013(); + printf("%llu\n", answer); return 0; } +#endif diff --git a/c/p0014.c b/c/p0014.c index 1af03e62..1a223950 100644 --- a/c/p0014.c +++ b/c/p0014.c @@ -20,6 +20,7 @@ Which starting number, under one million, produces the longest chain? NOTE: Once the chain starts the terms are allowed to go above one million. */ +#pragma once #include #include "include/macros.h" @@ -44,8 +45,7 @@ inline unsigned int collatz_len(unsigned long long n) { return ret; } - -int main(int argc, char const *argv[]) { +unsigned long long p0014() { unsigned long long answer = 2, length = 2, tmp; for (unsigned long long test = 3; test < 1000000; test++) { tmp = collatz_len(test); @@ -54,6 +54,13 @@ int main(int argc, char const *argv[]) { length = tmp; } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0014(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0015.c b/c/p0015.c index f4f92290..51c49a99 100644 --- a/c/p0015.c +++ b/c/p0015.c @@ -14,15 +14,20 @@ routes to the bottom right corner. How many such routes are there through a 20×20 grid? */ +#pragma once #include #include "include/math.h" #define lattice_paths(height, width) (n_choose_r(height + width, height)) +unsigned long long p0015() { + return lattice_paths(20, 20); +} +#ifndef UNITY_END int main(int argc, char const *argv[]) { - unsigned long long answer; - answer = lattice_paths(20, 20); + unsigned long long p0015(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0016.c b/c/p0016.c index 37382e04..bedc0eed 100644 --- a/c/p0016.c +++ b/c/p0016.c @@ -10,17 +10,24 @@ to do it than this, if I could manage arbitrary-precision multiplication more ef What is the sum of the digits of the number 21000? */ +#pragma once #include #include "include/bcd.h" - -int main(int argc, char const *argv[]) { +unsigned long long p0016() { unsigned long long answer = 0; BCD_int power = pow_cuint_cuint(256, 125); for (size_t i = 0; i < power.bcd_digits; i++) { answer += power.digits[i] & 0x0F; answer += power.digits[i] >> 4; } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0016(); printf("%llu\n", answer); return 0; } +#endif diff --git a/c/p0034.c b/c/p0034.c index 048f99e5..8208d9ed 100644 --- a/c/p0034.c +++ b/c/p0034.c @@ -10,11 +10,12 @@ their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. */ +#pragma once #include #include "include/digits.h" #include "include/math.h" -int main(int argc, char const *argv[]) { +unsigned long long p0034() { unsigned long long answer = 0, sum; digit_counter dc; for (unsigned long i = 10; i < 100000; i++) { @@ -28,6 +29,13 @@ int main(int argc, char const *argv[]) { } free_digit_counter(dc); } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0034(); printf("%llu", answer); return 0; } +#endif diff --git a/c/p0076.c b/c/p0076.c index e1972768..d5c6731b 100644 --- a/c/p0076.c +++ b/c/p0076.c @@ -38,11 +38,11 @@ It is possible to write five as a sum in exactly six different ways: How many different ways can one hundred be written as a sum of at least two positive integers? */ +#pragma once #include #include "include/macros.h" - -int main(int argc, char const *argv[]) { +unsigned int p0076() { unsigned int answer = 0; unsigned char idx, i, sum = 100, counts[101] = {0, 0, 100, 0}; while (!counts[100]) { @@ -66,6 +66,13 @@ int main(int argc, char const *argv[]) { sum += counts[i]; } } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned int answer = p0076(); printf("%u", answer); return 0; } +#endif diff --git a/c/test.c b/c/test.c index 908d2da0..9e4e593a 100644 --- a/c/test.c +++ b/c/test.c @@ -1,3 +1,4 @@ +#define UNITY_SUPPORT_TEST_CASES #include "Unity/src/unity.h" #include "p0001.c" #include "p0002.c" @@ -10,7 +11,7 @@ #include "p0009.c" #include "p0010.c" #include "p0011.c" -#include "p0012.c" +// #include "p0012.c" #include "p0013.c" #include "p0014.c" #include "p0015.c" @@ -20,30 +21,31 @@ typedef struct { unsigned int id; - uint64_t answer; - void * func; + unsigned long long answer; + unsigned long long (*func)(); } Answer; -static const Answer[] answers = { - {1, 1, p0001}, - {2, 1, p0002}, - {3, 1, p0003}, - {4, 1, p0004}, - {5, 1, p0005}, - {6, 1, p0006}, - {7, 1, p0007}, - {8, 1, p0008}, - {9, 1, p0009}, - {10, 1, p0010}, - {11, 1, p0011}, - {12, 1, p0012}, - {13, 1, p0013}, - {14, 1, p0014}, - {15, 1, p0015}, - {16, 1, p0016}, - {34, 1, p0034}, - {76, 1, p0076}, +#define ANSWERS_LEN (sizeof(answers) / sizeof(answers[0])) +static const Answer answers[] = { + {1, 233168, p0001}, + {2, 4613732, p0002}, + {3, 6857, p0003}, + {4, 906609, (unsigned long long (*)()) p0004}, + {5, 232792560, p0005}, + {6, 25164150, p0006}, + {7, 104743, p0007}, + {8, 23514624000, p0008}, + {9, 31875000, p0009}, + {10, 142913828922, p0010}, + {11, 70600674, p0011}, + {13, 5537376230, p0013}, + {14, 837799, p0014}, + {15, 137846528820, p0015}, + {16, 1366, p0016}, + {34, 40730, p0034}, + {76, 190569291, (unsigned long long (*)()) p0076}, }; +static unsigned long long current_index = 0; void setUp(void) { // set stuff up here @@ -53,14 +55,21 @@ void tearDown(void) { // clean stuff up here } -TEST_RANGE(0, sizeof(answers) / sizeof(answers[0]), 1) -void test_euler_answer(size_t index) { - Answer key = answers[index]; - TEST_ASSERT_EQUAL_INT64(key.answer, key.func()) +void test_euler_answer() { + Answer key = answers[current_index]; + unsigned long long result = key.func(); + char *msg = (char*)malloc(256 * sizeof(char)); + snprintf(msg, 256, "Euler problem %u should have an answer of %llu, but we actually got %llu", key.id, key.answer, result); + TEST_ASSERT_EQUAL_INT64_MESSAGE(key.answer, result, msg); + free(msg); } -int main(void) { +int main(int argc, char const *argv[]) { + char func_name[32]; UNITY_BEGIN(); - RUN_TEST(test_function_should_doAlsoDoBlah); + for (current_index = 0; current_index < ANSWERS_LEN; ++current_index) { + snprintf(func_name, 32, "test_euler_answer[%03u]", answers[current_index].id); + UnityDefaultTestRun(test_euler_answer, func_name, __LINE__); + } return UNITY_END(); } From b1f31de9565eb49d56b245c032742aea23777f46 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 20:52:19 -0500 Subject: [PATCH 021/326] Add deps to makefile --- c/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c/Makefile b/c/Makefile index 81012023..ca366ff3 100644 --- a/c/Makefile +++ b/c/Makefile @@ -19,6 +19,8 @@ test: dependencies $(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py dependencies: + git submodule init + git submodule update $(PIP) install -r requirements.txt $(USER_FLAG) $(PROXY_ARG) lint: From 99b539ffd21532f9bf1ccc12ae580f335b2ce00f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 21:02:03 -0500 Subject: [PATCH 022/326] Try to install niche compilers on ubuntu --- .github/workflows/on_push.yml | 4 ++++ c/Makefile | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index e1d34869..c6e8e869 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -116,6 +116,10 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up extra compilers (Linux) + if: ${{ matrix.os == ubuntu-latest }} + run: make icc pcc + - name: Use Python 3.7 uses: actions/setup-python@v5 with: diff --git a/c/Makefile b/c/Makefile index ca366ff3..0b2ce0d3 100644 --- a/c/Makefile +++ b/c/Makefile @@ -29,3 +29,33 @@ lint: else \ clang-tidy *.c; \ fi + +ifeq ($(OS),Windows_NT) +else +pcc: + sudo apt-get install -y build-essential flex bison + mkdir pcc pcc-libs + wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-1.1.0.tgz | tar -xz --no-seek -C pcc --strip-components=1 + wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-libs-1.1.0.tgz | tar -xz --no-seek -C pcc-libs --strip-components=1 + cd pcc; \ + sed -i 's/MANPAGE=@BINPREFIX@cpp/MANPAGE=@BINPREFIX@pcc-cpp/' cc/cpp/Makefile.in; \ + ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu; \ + sudo make && sudo make install; \ + cd ../pcc-libs; \ + ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu; \ + sudo make && sudo make install + +icc: + mkdir iccdir + wget -O - -o /dev/null https://registrationcenter-download.intel.com/akdlm/irc_nas/15873/intel-sw-tools-installer.tar.gz | tar -xz --no-seek -C iccdir --strip-components=1 + sudo apt-get update + sudo apt-get install -y cpio + cd iccdir; \ + sed -i -e "s/ACCEPT_EULA=decline/ACCEPT_EULA=accept/g" silent.cfg; \ + sed -i -e "s/ACTIVATION_TYPE=no_license/ACTIVATION_TYPE=serial_number/g" silent.cfg; \ + echo "ACTIVATION_SERIAL_NUMBER=CKDX-WNDG7BK7" >> silent.cfg; \ + echo "SELECTION_CONFIG_FILES_PATH=$PWD/packages.json" >> silent.cfg; \ + echo '{"selections":[{"moduleId":"intel_cpp_compiler"},{"moduleId":"intel_threading_building_blocks","isDependencyTool":true}]}' > packages.json; \ + sudo ./install.sh -s silent.cfg; \ + PATH="/opt/intel/system_studio_2019/bin${PATH:+:${PATH}}"; export PATH +endif \ No newline at end of file From 1a8ab2e97525680c5365ee2f3cd624dec6469d5b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 21:03:56 -0500 Subject: [PATCH 023/326] Typo --- .github/workflows/on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index c6e8e869..3242c931 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -117,7 +117,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up extra compilers (Linux) - if: ${{ matrix.os == ubuntu-latest }} + if: ${{ matrix.os == 'ubuntu-latest' }} run: make icc pcc - name: Use Python 3.7 From 29220ec0c1dbb09efb7b763050e6e217cd664366 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 22:41:49 -0500 Subject: [PATCH 024/326] fix up warnings in tests --- .github/workflows/on_push.yml | 4 ---- c/p0000_template.c | 4 +++- c/p0001.c | 4 +++- c/p0002.c | 4 +++- c/p0003.c | 5 +++-- c/p0004.c | 6 ++++-- c/p0005.c | 5 +++-- c/p0006.c | 4 +++- c/p0007.c | 4 +++- c/p0008.c | 4 +++- c/p0009.c | 4 +++- c/p0010.c | 4 +++- c/p0011.c | 6 ++++-- c/p0012.c | 4 +++- c/p0013.c | 6 ++++-- c/p0014.c | 4 +++- c/p0015.c | 6 ++++-- c/p0016.c | 4 +++- c/p0034.c | 4 +++- c/p0076.c | 4 +++- 20 files changed, 61 insertions(+), 29 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 3242c931..e1d34869 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -116,10 +116,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up extra compilers (Linux) - if: ${{ matrix.os == 'ubuntu-latest' }} - run: make icc pcc - - name: Use Python 3.7 uses: actions/setup-python@v5 with: diff --git a/c/p0000_template.c b/c/p0000_template.c index 937fbc22..6d0f0103 100644 --- a/c/p0000_template.c +++ b/c/p0000_template.c @@ -7,7 +7,8 @@ critque. This paragraph should be replaced by the problem description, excluding images. */ -#pragma once +#ifndef EULER_P0000 +#define EULER_P0000 #include unsigned long long p0000() { @@ -21,3 +22,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0001.c b/c/p0001.c index 205f074c..123ecc25 100644 --- a/c/p0001.c +++ b/c/p0001.c @@ -12,7 +12,8 @@ get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. */ -#pragma once +#ifndef EULER_P0001 +#define EULER_P0001 #include #include "include/iterator.h" @@ -40,3 +41,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0002.c b/c/p0002.c index 7f014ab4..985b3d98 100644 --- a/c/p0002.c +++ b/c/p0002.c @@ -14,7 +14,8 @@ By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. */ -#pragma once +#ifndef EULER_P0002 +#define EULER_P0002 #include #include "include/fibonacci.h" @@ -36,3 +37,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0003.c b/c/p0003.c index 449f2fee..08d2d0fe 100644 --- a/c/p0003.c +++ b/c/p0003.c @@ -10,8 +10,8 @@ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? */ - -#pragma once +#ifndef EULER_P0003 +#define EULER_P0003 #include #include "include/primes.h" @@ -32,3 +32,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0004.c b/c/p0004.c index 54c0c865..19da03ca 100644 --- a/c/p0004.c +++ b/c/p0004.c @@ -10,9 +10,9 @@ the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. */ -#pragma once +#ifndef EULER_P0004 +#define EULER_P0004 #include - #include "include/digits.h" unsigned int p0004() { @@ -41,7 +41,9 @@ unsigned int p0004() { #ifndef UNITY_END int main(int argc, char const *argv[]) { + unsigned int answer = p0004(); printf("%u", answer); return 0; } #endif +#endif diff --git a/c/p0005.c b/c/p0005.c index e342980d..3d2dda1e 100644 --- a/c/p0005.c +++ b/c/p0005.c @@ -11,8 +11,8 @@ number infrastructure a lot easier to set up. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? */ - -#pragma once +#ifndef EULER_P0005 +#define EULER_P0005 #include #include "include/macros.h" #include "include/primes.h" @@ -47,3 +47,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0006.c b/c/p0006.c index d618b55c..2880b009 100644 --- a/c/p0006.c +++ b/c/p0006.c @@ -19,7 +19,8 @@ numbers and the square of the sum is 3025 − 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. */ -#pragma once +#ifndef EULER_P0006 +#define EULER_P0006 #include unsigned long long p0006() { @@ -37,3 +38,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0007.c b/c/p0007.c index cc955ccb..214c5602 100644 --- a/c/p0007.c +++ b/c/p0007.c @@ -9,7 +9,8 @@ By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that What is the 10 001st prime number? */ -#pragma once +#ifndef EULER_P0007 +#define EULER_P0007 #include #include "include/primes.h" @@ -32,3 +33,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0008.c b/c/p0008.c index b28973aa..a8e29a13 100644 --- a/c/p0008.c +++ b/c/p0008.c @@ -30,7 +30,8 @@ The four adjacent digits in the 1000-digit number that have the greatest product Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? */ -#pragma once +#ifndef EULER_P0008 +#define EULER_P0008 #include #include "include/macros.h" @@ -78,3 +79,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0009.c b/c/p0009.c index 5bd4d036..f82098bb 100644 --- a/c/p0009.c +++ b/c/p0009.c @@ -13,7 +13,8 @@ For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ -#pragma once +#ifndef EULER_P0009 +#define EULER_P0009 #include unsigned long long p0009() { @@ -37,3 +38,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0010.c b/c/p0010.c index d09f4baa..34793087 100644 --- a/c/p0010.c +++ b/c/p0010.c @@ -9,7 +9,8 @@ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. */ -#pragma once +#ifndef EULER_P0010 +#define EULER_P0010 #include #include "include/primes.h" @@ -30,3 +31,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0011.c b/c/p0011.c index f2b1e29f..b66cf7bd 100644 --- a/c/p0011.c +++ b/c/p0011.c @@ -31,7 +31,8 @@ The product of these numbers is 26 × 63 × 78 × 14 = 1788696. What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid? */ -#pragma once +#ifndef EULER_P0011 +#define EULER_P0011 #include #include "include/macros.h" @@ -87,7 +88,8 @@ unsigned long long p0011() { #ifndef UNITY_END int main(int argc, char const *argv[]) { unsigned long long answer = p0011(); - printf("%lu", answer); + printf("%llu", answer); return 0; } #endif +#endif diff --git a/c/p0012.c b/c/p0012.c index d836264d..80fee87d 100644 --- a/c/p0012.c +++ b/c/p0012.c @@ -26,7 +26,8 @@ We can see that 28 is the first triangle number to have over five divisors. What is the value of the first triangle number to have over five hundred divisors? */ -#pragma once +#ifndef EULER_P0012 +#define EULER_P0012 #include #include "include/factors.h" @@ -70,3 +71,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0013.c b/c/p0013.c index 195f0555..e565d285 100644 --- a/c/p0013.c +++ b/c/p0013.c @@ -108,7 +108,8 @@ Work out the first ten digits of the sum of the following one-hundred 50-digit n 20849603980134001723930671666823555245252804609722 53503534226472524250874054075591789781264330331690 */ -#pragma once +#ifndef EULER_P0013 +#define EULER_P0013 #include #include "include/bcd.h" @@ -235,8 +236,9 @@ unsigned long long p0013() { #ifndef UNITY_END int main(int argc, char const *argv[]) { - BCD_int answer = p0013(); + unsigned long long answer = p0013(); printf("%llu\n", answer); return 0; } #endif +#endif diff --git a/c/p0014.c b/c/p0014.c index 1a223950..0e5243ae 100644 --- a/c/p0014.c +++ b/c/p0014.c @@ -20,7 +20,8 @@ Which starting number, under one million, produces the longest chain? NOTE: Once the chain starts the terms are allowed to go above one million. */ -#pragma once +#ifndef EULER_P0014 +#define EULER_P0014 #include #include "include/macros.h" @@ -64,3 +65,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0015.c b/c/p0015.c index 51c49a99..1e12eebd 100644 --- a/c/p0015.c +++ b/c/p0015.c @@ -14,7 +14,8 @@ routes to the bottom right corner. How many such routes are there through a 20×20 grid? */ -#pragma once +#ifndef EULER_P0015 +#define EULER_P0015 #include #include "include/math.h" @@ -26,8 +27,9 @@ unsigned long long p0015() { #ifndef UNITY_END int main(int argc, char const *argv[]) { - unsigned long long p0015(); + unsigned long long answer = p0015(); printf("%llu", answer); return 0; } #endif +#endif diff --git a/c/p0016.c b/c/p0016.c index bedc0eed..4402768f 100644 --- a/c/p0016.c +++ b/c/p0016.c @@ -10,7 +10,8 @@ to do it than this, if I could manage arbitrary-precision multiplication more ef What is the sum of the digits of the number 21000? */ -#pragma once +#ifndef EULER_P0016 +#define EULER_P0016 #include #include "include/bcd.h" @@ -31,3 +32,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0034.c b/c/p0034.c index 8208d9ed..de5faff6 100644 --- a/c/p0034.c +++ b/c/p0034.c @@ -10,7 +10,8 @@ their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. */ -#pragma once +#ifndef EULER_P0034 +#define EULER_P0034 #include #include "include/digits.h" #include "include/math.h" @@ -39,3 +40,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif diff --git a/c/p0076.c b/c/p0076.c index d5c6731b..a8764b88 100644 --- a/c/p0076.c +++ b/c/p0076.c @@ -38,7 +38,8 @@ It is possible to write five as a sum in exactly six different ways: How many different ways can one hundred be written as a sum of at least two positive integers? */ -#pragma once +#ifndef EULER_P0076 +#define EULER_P0076 #include #include "include/macros.h" @@ -76,3 +77,4 @@ int main(int argc, char const *argv[]) { return 0; } #endif +#endif From fe67cc92512de5b672c5e9e14a9f632e0caf738c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 22:48:54 -0500 Subject: [PATCH 025/326] change python version to make mac work --- .github/workflows/on_push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index e1d34869..a3f2ef63 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -116,10 +116,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Python 3.7 + - name: Use Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.10 # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 From c033dbe3275a8dda5ddbd13e4cc59f87087413d4 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 23 Jun 2024 22:56:07 -0500 Subject: [PATCH 026/326] coerce to string --- .github/workflows/on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index a3f2ef63..c1856fb5 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -119,7 +119,7 @@ jobs: - name: Use Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.10 + python-version: "3.10" # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 From d61d4e6c35870e9af8d3720596d44418d0e6df94 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 20:48:11 -0500 Subject: [PATCH 027/326] attempt to enable caching, reduce usage --- .github/workflows/on_push.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index c1856fb5..a390d4b3 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -5,10 +5,9 @@ on: push jobs: python: strategy: - fail-fast: false matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, windows-latest, macos-13] + os: [ubuntu-latest, windows-latest] exclude: - os: ubuntu-latest version: 3.6 @@ -25,6 +24,10 @@ jobs: version: 3.12 - os: ubuntu-latest version: graalpy-23.1 + - os: macos-latest + version: 3.12 + - os: macos-13 + version: 3.12 - os: ubuntu-latest version: graalpy-24.0 - os: ubuntu-latest @@ -42,13 +45,16 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.version }} + cache: 'pip' + cache-dependency-path: | + python/requirements.txt + c/requirements.txt - name: Run tests run: make pytest LINT=false javascript: strategy: - fail-fast: false matrix: version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] os: [ubuntu-latest, windows-latest, macos-latest] @@ -95,6 +101,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.version }} + cache: 'npm' + cache-dependency-path: 'javascript/package-lock.json' - name: Run tests run: make jstest @@ -120,6 +128,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" + cache-dependency-path: c/requirements.txt # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 From 3deb14097cb1d5847cf1dc5d6434287ea4c2626a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 23:17:41 -0500 Subject: [PATCH 028/326] Begin csharp port --- .github/workflows/on_push.yml | 30 ++++++++++++++++++++++++- Makefile | 5 ++++- csharp/Makefile | 10 +++++++++ csharp/README.md | 41 +++++++++++++++++++++++++++++++++++ csharp/csharp.csproj | 27 +++++++++++++++++++++++ csharp/include/primes.cs | 0 csharp/p0000_template.cs | 0 csharp/test.cs | 0 8 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 csharp/Makefile create mode 100644 csharp/README.md create mode 100644 csharp/csharp.csproj create mode 100644 csharp/include/primes.cs create mode 100644 csharp/p0000_template.cs create mode 100644 csharp/test.cs diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index a390d4b3..91f0bc61 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -109,7 +109,6 @@ jobs: c: strategy: - fail-fast: false matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, @@ -144,3 +143,32 @@ jobs: - name: Run tests run: make ctest + + csharp: + strategy: + fail-fast: false + matrix: + net_version: [5, 6, 7, 8] + os: [ubuntu-latest, windows-latest] + include: + - net_version: 8 + os: macos-latest + - net_version: 8 + os: macos-13 + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET ${{ matrix.net_version }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.net_version }} + cache: true + cache-dependency-path: 'csharp/packages.lock.json' + + - name: Dependencies + run: make csdependencies + + - name: Run Tests + run: make cstest diff --git a/Makefile b/Makefile index 11783a83..9f31a72a 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,11 @@ py%: c%: cd c && $(MAKE) $* $(MFLAGS) +cs%: + cd csharp && $(MAKE) $* $(MFLAGS) + js%: cd javascript && $(MAKE) $* $(MFLAGS) %: - $(MAKE) c$* js$* py$* $(MFLAGS) + $(MAKE) c$* cs$* js$* py$* $(MFLAGS) diff --git a/csharp/Makefile b/csharp/Makefile new file mode 100644 index 00000000..cb77dbc5 --- /dev/null +++ b/csharp/Makefile @@ -0,0 +1,10 @@ +test: dependencies + dotnet test + +test_%: dependencies + echo "WARNING: multithreaded tests not supported on javascript" + $(MAKE) test + +dependencies: + dotnet restore + diff --git a/csharp/README.md b/csharp/README.md new file mode 100644 index 00000000..cbc152ef --- /dev/null +++ b/csharp/README.md @@ -0,0 +1,41 @@ +# C# Section + +All problems are solved in .NET 6, though an effort is made to support other versions. + +## Organization + +All C# files share a common prefix with their problem number. All shared functions are defined in the include folder. + +## Makefile + +There are two main recipes in this Makefile + +### dependencies + +This recipe installs all the required and test dependencies. See the Dependencies section for more info + +### test + +This recipe runs tests in multiple threads + +## Tests + +### Prime Infrastructure Test + +This test checks five things: + +1. It checks `is_prime()` for numbers up to `MAX_PRIME`, where that is defined in the test +2. It checks that `is_composite()` returns truthy values on composites in that range, and falsey values on primes +3. It checks that `is_composite()` returns the smallest prime factor on composite numbers +4. It checks that the prime numbers are generated in the correct order +5. It checks that all these operations are completed in less than 200ns * `MAX_PRIME` + +### Generic Problems + +For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will run it as many times as the benchmark plugin wants. Otherwise it is run exactly once. + +A test fails if it gets the wrong answer or if it takes more than 1 minute. + +## Dependencies + +I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. diff --git a/csharp/csharp.csproj b/csharp/csharp.csproj new file mode 100644 index 00000000..50358661 --- /dev/null +++ b/csharp/csharp.csproj @@ -0,0 +1,27 @@ + + + + net6.0 + enable + enable + Linux + . + true + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/csharp/include/primes.cs b/csharp/include/primes.cs new file mode 100644 index 00000000..e69de29b diff --git a/csharp/p0000_template.cs b/csharp/p0000_template.cs new file mode 100644 index 00000000..e69de29b diff --git a/csharp/test.cs b/csharp/test.cs new file mode 100644 index 00000000..e69de29b From 1495b7a645a7267011c952e62dda6d7874cf3849 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 23:28:42 -0500 Subject: [PATCH 029/326] add lock file --- csharp/packages.lock.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 csharp/packages.lock.json diff --git a/csharp/packages.lock.json b/csharp/packages.lock.json new file mode 100644 index 00000000..e69de29b From 21fc481bf45a91767cb0eb059a165abd4aab047f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 23:34:17 -0500 Subject: [PATCH 030/326] Remove references to other languages --- csharp/Makefile | 3 +-- csharp/README.md | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/csharp/Makefile b/csharp/Makefile index cb77dbc5..83c76c5d 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,8 +1,7 @@ test: dependencies - dotnet test + dotnet test --nologo test_%: dependencies - echo "WARNING: multithreaded tests not supported on javascript" $(MAKE) test dependencies: diff --git a/csharp/README.md b/csharp/README.md index cbc152ef..3147bd94 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -32,7 +32,7 @@ This test checks five things: ### Generic Problems -For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will run it as many times as the benchmark plugin wants. Otherwise it is run exactly once. +For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will always be run. Otherwise it tries to detect the `NO_SLOW` environment variable and dynamically skip them. A test fails if it gets the wrong answer or if it takes more than 1 minute. From d9b79b152aa60db30b345c585486a0f1895b67aa Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 23:48:50 -0500 Subject: [PATCH 031/326] Update readme --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 68f19242..362ed2b5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,20 @@ # LivInTheLookingGlass's Project Euler solutions -Windows testing[¹](#footnotes): [![Windows build status](https://ci.appveyor.com/api/projects/status/lqi44hqr7jgqjwpy/branch/master?svg=true)](https://ci.appveyor.com/project/gappleto97/euler) Linux testing[²](#footnotes): [![Linux build status](https://api.shippable.com/projects/5d7ab0a9686e0a0007cb5970/badge?branch=master)](https://app.shippable.com/github/gappleto97/Euler/dashboard) OSX testing[³](#footnotes): [![OSX build status](https://travis-ci.org/gappleto97/Euler.svg?branch=master)](https://travis-ci.org/gappleto97/Euler) - This is the repository I keep for prospective employers to look at project Euler code that I have written. This is useful because it has defined problems and answers such that you can compare answers with other people. +All solutions are tested against multiple operating systems and language/compiler versions. For more information, see `.github/workflows/on_push.yml` + ## This is NOT meant to help others on Project Euler problems ## If you are working on Project Euler problems, DO NOT use this as a source The repo is divided into sections for each language. The top-level Makefile will direct recipes using prefixes -- make c_____ will go to the c Makefile -- make py______ will go to the python Makefile -- make js______ will go to the javascript Makefile - -## Footnotes - -1: Windows testing is done on C, Python, and Javascript. C compilers are CL (MSVC 2015/2017 x86/x64) and clang - -2: Linux testing is done on Ubuntu 14.04 for C, Python, and Javascript. C compilers are gcc, clang, tcc, and pcc. The pcc and tcc compilers are marked as allowed failures because tcc implements no optimizations and might have time failures, and pcc seems to have errors including `` and `` +- `make c*` will go to the c Makefile +- `make cs*` will go to the csharp Makefile +- `make py*` will go to the python Makefile +- `make js*` will go to the javascript Makefile -3: OSX testing is done on C, Python, and Javascript. C compilers are gcc and clang +For more information, please see the README documents in each section. From 81c65db755660bb132ce921acc44ff36ca03ed09 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 24 Jun 2024 23:59:05 -0500 Subject: [PATCH 032/326] Delete unused service files --- .travis.yml | 67 -------------------------------------- appveyor.yml | 89 --------------------------------------------------- shippable.yml | 52 ------------------------------ 3 files changed, 208 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 shippable.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1d972411..00000000 --- a/.travis.yml +++ /dev/null @@ -1,67 +0,0 @@ -matrix: - include: - - language: generic - python: 3.6 - os: osx - env: pyver=3.6 pydist=macpython linter=true -# pydist=macports -# pydist=homebrew - - language: node_js - node_js: "11" - os: osx - env: jsver=11 linter=true - - language: node_js - node_js: "11" - os: osx - env: jsver=11 - - language: node_js - node_js: "10" - os: osx - env: jsver=10 - - language: node_js - node_js: "9" - os: osx - env: jsver=9 - - language: node_js - node_js: "8" - os: osx - env: jsver=8 - - language: c - os: osx - env: COMPILER_OVERRIDE=clang - - language: c - os: osx - env: COMPILER_OVERRIDE=gcc GCC_OVERRIDE=gcc-9 - osx_image: xcode10.1 - - language: generic - python: 3.6 - os: osx - env: pyver=3.6 pydist=macpython NO_SLOW=true -# pydist=macports -# pydist=homebrew - - language: generic - python: 3.7 - os: osx - env: pyver=3.7 pydist=macpython NO_SLOW=true -# pydist=macports -# pydist=homebrew - # - language: generic - # python: 3.8 - # os: osx - # env: pyver=3.8 pydist=macpython NO_SLOW=true -# pydist=macports -# pydist=homebrew - - language: generic - python: pypy3 - os: osx - env: pyver=pypy3 pydist=homebrew NO_SLOW=true - - language: generic - python: 3.7 - os: osx - env: pyver=3.7 pydist=macpython ONLY_SLOW=true - allow_failures: - - env: ONLY_SLOW=true - - python: pypy3 - -script: - - sh ./.scripts/travis_script.sh diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index cf01d5d1..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,89 +0,0 @@ -image: -- Visual Studio 2017 - -environment: - matrix: - - NODE: "11" - LINT: "true" - - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - LINT: "true" - - - C: "VS 2015 x86" - VCVARS: 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86' - COMPILER_OVERRIDE: 'cl' - NO_SLOW: "true" - - - C: "VS 2015 x86_64" - WIN_SDK: 'call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64' - VCVARS: 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64' - COMPILER_OVERRIDE: 'cl' - NO_SLOW: "true" - - - C: "VS 2017 x86" - VCVARS: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"' - COMPILER_OVERRIDE: 'cl' - NO_SLOW: "true" - - - C: "VS 2017 x86_64" - VCVARS: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"' - COMPILER_OVERRIDE: 'cl' - NO_SLOW: "true" - - - C: "Clang" - COMPILER_OVERRIDE: 'clang' - NO_SLOW: "true" - - - NODE: "8" - - NODE: "9" - - NODE: "10" - - NODE: "11" - - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - NO_SLOW: "true" - - - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - NO_SLOW: "true" - - - PYTHON: "C:\\Python37" - PYTHON_VERSION: "3.7" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - NO_SLOW: "true" - - - PYTHON: "C:\\Python37-x64" - PYTHON_VERSION: "3.7" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - NO_SLOW: "true" - - - PYTHON_VERSION: "pypy3" - RUN: "%APPVEYOR_BUILD_FOLDER%\\pypy3.6-v7.1.1-win32\\pypy" - PIP: "%RUN% -m pip" - PYPY: "powershell.exe %APPVEYOR_BUILD_FOLDER%\\.scripts\\installpypy3.ps1" - NO_SLOW: "true" - - - PYTHON: "C:\\Python37-x64" - PYTHON_VERSION: "3.7" - RUN: "%PYTHON%\\python" - PIP: "%PYTHON%\\Scripts\\pip" - ONLY_SLOW: "true" - -matrix: - allow_failures: - - PYTHON_VERSION: "pypy3" - - ONLY_SLOW: "true" - -test: off - -build_script: - - .scripts\\appveyor_script.bat diff --git a/shippable.yml b/shippable.yml deleted file mode 100644 index d7090c4c..00000000 --- a/shippable.yml +++ /dev/null @@ -1,52 +0,0 @@ -language: python - -matrix: - include: - - python: 3.7 - env: pyver=true linter=true - - language: node_js - node_js: "11" - env: jsver=11 linter=true - - language: node_js - node_js: "11" - env: jsver=11 - - language: node_js - node_js: "10" - env: jsver=10 - - language: node_js - node_js: "9" - env: jsver=9 - - language: node_js - node_js: "8" - env: jsver=8 - - language: c - env: COMPILER_OVERRIDE=clang - python: 3.7 - - language: c - env: COMPILER_OVERRIDE=gcc - python: 3.7 - - language: c - env: COMPILER_OVERRIDE=tcc - python: 3.7 - - language: c - env: COMPILER_OVERRIDE=pcc pcc=true - python: 3.7 - - language: c - env: COMPILER_OVERRIDE=icc icc=true - python: 3.7 - - env: pyver=true NO_SLOW=true - python: 3.7 - - env: py36=true pyver=true NO_SLOW=true - - env: pyver=true NO_SLOW=true - python: pypy3 - - env: pyver=true ONLY_SLOW=true NO_SLOW= - python: 3.7 - allow_failures: - - env: COMPILER_OVERRIDE=tcc - - env: COMPILER_OVERRIDE=pcc pcc=true - - env: COMPILER_OVERRIDE=icc icc=true - - env: pyver=true ONLY_SLOW=true NO_SLOW= - -build: - ci: - - sh ./.scripts/shippable_script.sh From eee09327513c23618a18427ae2eda753ad9a5197 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 00:13:05 -0500 Subject: [PATCH 033/326] Move more scripted workflows to GitHub Actions --- .github/workflows/on_push.yml | 45 +++++++++++++++++++++++++++++++++++ .scripts/appveyor_script.bat | 33 ------------------------- .scripts/installpypy3.ps1 | 4 ---- .scripts/travis_script.sh | 35 --------------------------- 4 files changed, 45 insertions(+), 72 deletions(-) delete mode 100644 .scripts/appveyor_script.bat delete mode 100644 .scripts/installpypy3.ps1 delete mode 100644 .scripts/travis_script.sh diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 91f0bc61..c27cbcd0 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -3,6 +3,23 @@ name: Euler Regression Check on: push jobs: +# python-lint: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# +# - name: Use Python 3.12 +# uses: actions/setup-python@v5 +# with: +# python-version: 3.12 +# cache: 'pip' +# cache-dependency-path: | +# python/requirements.txt +# c/requirements.txt +# +# - name: Lint +# run: make pytest LINT=only + python: strategy: matrix: @@ -53,6 +70,24 @@ jobs: - name: Run tests run: make pytest LINT=false + javascript-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.version }} + cache: 'npm' + cache-dependency-path: 'javascript/package-lock.json' + + - name: Fetch ESLint + run: npm install eslint-config-google@latest eslint@>=5.16.0 + + - name: Lint + run: npx eslint javascript/*.js + javascript: strategy: matrix: @@ -107,6 +142,16 @@ jobs: - name: Run tests run: make jstest +c-lint: + steps: + - uses: actions/checkout@v3 + + - name: Setup clang-tidy + run: sudo apt-get install -y clang-tidy + + - name: Run tests + run: make clint + c: strategy: matrix: diff --git a/.scripts/appveyor_script.bat b/.scripts/appveyor_script.bat deleted file mode 100644 index 15d4dcd1..00000000 --- a/.scripts/appveyor_script.bat +++ /dev/null @@ -1,33 +0,0 @@ -IF DEFINED PIP ( - %PYPY% - cd python - %PIP% install -r requirements.txt - IF DEFINED LINT ( - %RUN% -m pytest -vl --mypy --mypy-ignore-missing-imports --flake8 --isort -k "not test_problem and not test_is_prime and not test_groupwise" || goto :error - ) ELSE ( - %RUN% -m pytest test_euler.py -vl --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-verbose || goto :error - ) -) ELSE ( - IF DEFINED NODE ( - powershell -Command "Install-Product node $env:NODE" - cd javascript - IF DEFINED LINT ( - npm install eslint-config-google@latest eslint@>=5.16.0 - npx eslint *.js || goto :error - ) ELSE ( - npm install - npx mocha || goto :error - ) - ) ELSE ( - cd c - C:\Python36\python -m pip install -r requirements.txt - %WIN_SDK% - %VCVARS% - C:\Python36\python -m pytest test_euler.py -vl --benchmark-min-time=0.05 --benchmark-group-by=fullfunc --benchmark-sort=fullname --benchmark-verbose || goto :error - ) -) -goto :EOF - -:error -ECHO Failed with error #%errorlevel%. -exit /b %errorlevel% diff --git a/.scripts/installpypy3.ps1 b/.scripts/installpypy3.ps1 deleted file mode 100644 index 0eed4f74..00000000 --- a/.scripts/installpypy3.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -python -c "import urllib; urllib.urlretrieve('https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.1.1-win32.zip', 'pypy3.6-v7.1.1-win32.zip'); urllib.urlretrieve('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py')" -7z x pypy3.6-v7.1.1-win32.zip > Out-Null -pypy3.6-v7.1.1-win32\pypy get-pip.py -pypy3.6-v7.1.1-win32\pypy -m pip install setuptools \ No newline at end of file diff --git a/.scripts/travis_script.sh b/.scripts/travis_script.sh deleted file mode 100644 index add2a42b..00000000 --- a/.scripts/travis_script.sh +++ /dev/null @@ -1,35 +0,0 @@ - -set -e; -if [ $pyver ]; then - if [ $pyver != pypy3 ]; then - git clone https://github.com/gappleto97/terryfy; - source terryfy/travis_tools.sh; - get_python_environment $pydist $pyver; - fi - if [ $pyver == pypy3 ]; then - brew install $pyver; - export PYTHON_EXE=$pyver; - export PIP_CMD="$PYTHON_EXE -m pip"; - fi - $PIP_CMD install virtualenv; - $PYTHON_EXE -m virtualenv -p $PYTHON_EXE venv; - source venv/bin/activate; - if [ $linter ]; then - make pytest PY=python LINT=true USER_FLAG= - else - make pytest PY=python LINT=false MYPY= USER_FLAG= - fi -elif [ $jsver ]; then - if [ $linter ]; then - cd javascript; - npm install eslint-config-google@latest eslint@>=5.16.0; - npx eslint *.js && echo "Linting successful!" - else - make jstest; - fi -else - if [ $GCC_OVERRIDE ]; then - brew install gcc; - fi - make ctest; -fi From ca33986d60deef32b49b2df4f80b386a719fe215 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 00:15:04 -0500 Subject: [PATCH 034/326] typo --- .github/workflows/on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index c27cbcd0..aed0e52b 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -142,7 +142,7 @@ jobs: - name: Run tests run: make jstest -c-lint: + c-lint: steps: - uses: actions/checkout@v3 From 396380b08ac9bbde4fbf43f86a88571a10f8ec9c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 00:16:10 -0500 Subject: [PATCH 035/326] add forgotten os --- .github/workflows/on_push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index aed0e52b..9060139f 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -143,6 +143,7 @@ jobs: run: make jstest c-lint: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 713ade30c31bdd8246eb941f7e1a2978ca5152c2 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:23:41 -0500 Subject: [PATCH 036/326] Continue csharp port --- .github/workflows/on_push.yml | 24 +- .gitignore | 5 + .stignore | 5 + Euler.sln | 25 + Makefile | 6 +- .../Euler.Test.csproj} | 20 +- csharp/Euler.Test/Usings.cs | 2 + csharp/Euler.Test/packages.lock.json | 1124 +++++++++++++++++ csharp/Euler.Test/test.cs | 20 + csharp/Euler/Euler.csproj | 12 + csharp/Euler/p0000_template.cs | 16 + csharp/Euler/packages.lock.json | 6 + csharp/Makefile | 2 + csharp/README.md | 6 +- csharp/csharp.sln | 28 + csharp/p0000_template.cs | 0 csharp/packages.lock.json | 0 csharp/test.cs | 0 javascript/Makefile | 2 + 19 files changed, 1287 insertions(+), 16 deletions(-) create mode 100644 Euler.sln rename csharp/{csharp.csproj => Euler.Test/Euler.Test.csproj} (69%) create mode 100644 csharp/Euler.Test/Usings.cs create mode 100644 csharp/Euler.Test/packages.lock.json create mode 100644 csharp/Euler.Test/test.cs create mode 100644 csharp/Euler/Euler.csproj create mode 100644 csharp/Euler/p0000_template.cs create mode 100644 csharp/Euler/packages.lock.json create mode 100644 csharp/csharp.sln delete mode 100644 csharp/p0000_template.cs delete mode 100644 csharp/packages.lock.json delete mode 100644 csharp/test.cs diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 9060139f..ebb7b8b9 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -75,10 +75,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.version }} + - name: Use Node.js 22 uses: actions/setup-node@v3 with: - node-version: ${{ matrix.version }} + node-version: 22 cache: 'npm' cache-dependency-path: 'javascript/package-lock.json' @@ -86,7 +86,7 @@ jobs: run: npm install eslint-config-google@latest eslint@>=5.16.0 - name: Lint - run: npx eslint javascript/*.js + run: make jslint javascript: strategy: @@ -211,10 +211,26 @@ jobs: with: dotnet-version: ${{ matrix.net_version }} cache: true - cache-dependency-path: 'csharp/packages.lock.json' + cache-dependency-path: 'csharp/*/packages.lock.json' - name: Dependencies run: make csdependencies - name: Run Tests run: make cstest + + csharp-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8 + cache: true + cache-dependency-path: 'csharp/*/packages.lock.json' + + - name: Run Linter + run: make cslint + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f324336..5862b85a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,8 @@ javascript/node_modules/** **/*.exe **/build/** venv/** +**.dll +**.pdb +csharp/*/obj +csharp/*/bin +**/TestResults \ No newline at end of file diff --git a/.stignore b/.stignore index 70cbc1c2..d4cd1eac 100644 --- a/.stignore +++ b/.stignore @@ -6,3 +6,8 @@ javascript/node_modules/** **/*.exe **/build/** venv/** +**.dll +**.pdb +csharp/*/obj +csharp/*/bin +**/TestResults \ No newline at end of file diff --git a/Euler.sln b/Euler.sln new file mode 100644 index 00000000..e4e145d3 --- /dev/null +++ b/Euler.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csharp", "csharp\csharp.csproj", "{83B915D6-6A7D-4946-8EF2-16E2C154A555}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {83B915D6-6A7D-4946-8EF2-16E2C154A555}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83B915D6-6A7D-4946-8EF2-16E2C154A555}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83B915D6-6A7D-4946-8EF2-16E2C154A555}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83B915D6-6A7D-4946-8EF2-16E2C154A555}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B284F865-A51E-4E11-A5A0-A3D743E4F8E7} + EndGlobalSection +EndGlobal diff --git a/Makefile b/Makefile index 9f31a72a..f7ea1dd3 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,12 @@ PROXY?= py%: cd python && $(MAKE) $* $(MFLAGS) -c%: - cd c && $(MAKE) $* $(MFLAGS) - cs%: cd csharp && $(MAKE) $* $(MFLAGS) +c%: + cd c && $(MAKE) $* $(MFLAGS) + js%: cd javascript && $(MAKE) $* $(MFLAGS) diff --git a/csharp/csharp.csproj b/csharp/Euler.Test/Euler.Test.csproj similarity index 69% rename from csharp/csharp.csproj rename to csharp/Euler.Test/Euler.Test.csproj index 50358661..52c4cc33 100644 --- a/csharp/csharp.csproj +++ b/csharp/Euler.Test/Euler.Test.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -7,21 +7,25 @@ Linux . true + false - + - - - - all + + runtime; build; native; contentfiles; analyzers; buildtransitive - - all + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/csharp/Euler.Test/Usings.cs b/csharp/Euler.Test/Usings.cs new file mode 100644 index 00000000..cf827197 --- /dev/null +++ b/csharp/Euler.Test/Usings.cs @@ -0,0 +1,2 @@ +global using Euler; +global using Xunit; \ No newline at end of file diff --git a/csharp/Euler.Test/packages.lock.json b/csharp/Euler.Test/packages.lock.json new file mode 100644 index 00000000..243aae9a --- /dev/null +++ b/csharp/Euler.Test/packages.lock.json @@ -0,0 +1,1124 @@ +{ + "version": 1, + "dependencies": { + "net6.0": { + "coverlet.collector": { + "type": "Direct", + "requested": "[3.1.2, )", + "resolved": "3.1.2", + "contentHash": "wuLDIDKD5XMt0A7lE31JPenT7QQwZPFkP5rRpdJeblyXZ9MGLI8rYjvm5fvAKln+2/X+4IxxQDxBtwdrqKNLZw==" + }, + "Microsoft.NET.Test.Sdk": { + "type": "Direct", + "requested": "[17.1.0, )", + "resolved": "17.1.0", + "contentHash": "MVKvOsHIfrZrvg+8aqOF5dknO/qWrR1sWZjMPQ1N42MKMlL/zQL30FQFZxPeWfmVKWUWAOmAHYsqB5OerTKziw==", + "dependencies": { + "Microsoft.CodeCoverage": "17.1.0", + "Microsoft.TestPlatform.TestHost": "17.1.0" + } + }, + "Moq": { + "type": "Direct", + "requested": "[4.20.70, )", + "resolved": "4.20.70", + "contentHash": "4rNnAwdpXJBuxqrOCzCyICXHSImOTRktCgCWXWykuF1qwoIsVvEnR7PjbMk/eLOxWvhmj5Kwt+kDV3RGUYcNwg==", + "dependencies": { + "Castle.Core": "5.1.1" + } + }, + "xunit": { + "type": "Direct", + "requested": "[2.4.1, )", + "resolved": "2.4.1", + "contentHash": "XNR3Yz9QTtec16O0aKcO6+baVNpXmOnPUxDkCY97J+8krUYxPvXT1szYYEUdKk4sB8GOI2YbAjRIOm8ZnXRfzQ==", + "dependencies": { + "xunit.analyzers": "0.10.0", + "xunit.assert": "[2.4.1]", + "xunit.core": "[2.4.1]" + } + }, + "xunit.runner.visualstudio": { + "type": "Direct", + "requested": "[2.4.3, )", + "resolved": "2.4.3", + "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" + }, + "Castle.Core": { + "type": "Transitive", + "resolved": "5.1.1", + "contentHash": "rpYtIczkzGpf+EkZgDr9CClTdemhsrwA/W5hMoPjLkRFnXzH44zDLoovXeKtmxb1ykXK9aJVODSpiJml8CTw2g==", + "dependencies": { + "System.Diagnostics.EventLog": "6.0.0" + } + }, + "Microsoft.CodeCoverage": { + "type": "Transitive", + "resolved": "17.1.0", + "contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.0.1", + "contentHash": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", + "dependencies": { + "System.Collections": "4.0.11", + "System.Diagnostics.Debug": "4.0.11", + "System.Dynamic.Runtime": "4.0.11", + "System.Globalization": "4.0.11", + "System.Linq": "4.1.0", + "System.Linq.Expressions": "4.1.0", + "System.ObjectModel": "4.0.12", + "System.Reflection": "4.1.0", + "System.Reflection.Extensions": "4.0.1", + "System.Reflection.Primitives": "4.0.1", + "System.Reflection.TypeExtensions": "4.1.0", + "System.Resources.ResourceManager": "4.0.1", + "System.Runtime": "4.1.0", + "System.Runtime.Extensions": "4.1.0", + "System.Runtime.InteropServices": "4.1.0", + "System.Threading": "4.0.11" + } + }, + "Microsoft.NETCore.Platforms": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + }, + "Microsoft.NETCore.Targets": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" + }, + "Microsoft.TestPlatform.ObjectModel": { + "type": "Transitive", + "resolved": "17.1.0", + "contentHash": "OMo/FYnKGy3lZEK0gfitskRM3ga/YBt6MyCyFPq0xNLeybGOQ6HnYNAAvzyePo5WPuMiw3LX+HiuRWNjnas1fA==", + "dependencies": { + "NuGet.Frameworks": "5.11.0", + "System.Reflection.Metadata": "1.6.0" + } + }, + "Microsoft.TestPlatform.TestHost": { + "type": "Transitive", + "resolved": "17.1.0", + "contentHash": "JS0JDLniDhIzkSPLHz7N/x1CG8ywJOtwInFDYA3KQvbz+ojGoT5MT2YDVReL1b86zmNRV8339vsTSm/zh0RcMg==", + "dependencies": { + "Microsoft.TestPlatform.ObjectModel": "17.1.0", + "Newtonsoft.Json": "9.0.1" + } + }, + "Microsoft.Win32.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "NETStandard.Library": { + "type": "Transitive", + "resolved": "1.6.1", + "contentHash": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.Win32.Primitives": "4.3.0", + "System.AppContext": "4.3.0", + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Console": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tools": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Calendars": "4.3.0", + "System.IO": "4.3.0", + "System.IO.Compression": "4.3.0", + "System.IO.Compression.ZipFile": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.Net.Http": "4.3.0", + "System.Net.Primitives": "4.3.0", + "System.Net.Sockets": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Security.Cryptography.X509Certificates": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Timer": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XDocument": "4.3.0" + } + }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "9.0.1", + "contentHash": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", + "dependencies": { + "Microsoft.CSharp": "4.0.1", + "System.Collections": "4.0.11", + "System.Diagnostics.Debug": "4.0.11", + "System.Dynamic.Runtime": "4.0.11", + "System.Globalization": "4.0.11", + "System.IO": "4.1.0", + "System.Linq": "4.1.0", + "System.Linq.Expressions": "4.1.0", + "System.ObjectModel": "4.0.12", + "System.Reflection": "4.1.0", + "System.Reflection.Extensions": "4.0.1", + "System.Resources.ResourceManager": "4.0.1", + "System.Runtime": "4.1.0", + "System.Runtime.Extensions": "4.1.0", + "System.Runtime.Serialization.Primitives": "4.1.1", + "System.Text.Encoding": "4.0.11", + "System.Text.Encoding.Extensions": "4.0.11", + "System.Text.RegularExpressions": "4.1.0", + "System.Threading": "4.0.11", + "System.Threading.Tasks": "4.0.11", + "System.Xml.ReaderWriter": "4.0.11", + "System.Xml.XDocument": "4.0.11" + } + }, + "NuGet.Frameworks": { + "type": "Transitive", + "resolved": "5.11.0", + "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" + }, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==" + }, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==" + }, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==" + }, + "runtime.native.System": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "runtime.native.System.IO.Compression": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "runtime.native.System.Net.Http": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "runtime.native.System.Security.Cryptography.Apple": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", + "dependencies": { + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" + } + }, + "runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", + "dependencies": { + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==" + }, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==" + }, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + }, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==" + }, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==" + }, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" + }, + "System.AppContext": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Buffers": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Collections": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Concurrent": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Console": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Diagnostics.Debug": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.DiagnosticSource": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Diagnostics.EventLog": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==" + }, + "System.Diagnostics.Tools": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.Tracing": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Dynamic.Runtime": { + "type": "Transitive", + "resolved": "4.0.11", + "contentHash": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", + "dependencies": { + "System.Collections": "4.0.11", + "System.Diagnostics.Debug": "4.0.11", + "System.Globalization": "4.0.11", + "System.Linq": "4.1.0", + "System.Linq.Expressions": "4.1.0", + "System.ObjectModel": "4.0.12", + "System.Reflection": "4.1.0", + "System.Reflection.Emit": "4.0.1", + "System.Reflection.Emit.ILGeneration": "4.0.1", + "System.Reflection.Primitives": "4.0.1", + "System.Reflection.TypeExtensions": "4.1.0", + "System.Resources.ResourceManager": "4.0.1", + "System.Runtime": "4.1.0", + "System.Runtime.Extensions": "4.1.0", + "System.Threading": "4.0.11" + } + }, + "System.Globalization": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Calendars": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "System.IO": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.Compression": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Buffers": "4.3.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.IO.Compression": "4.3.0" + } + }, + "System.IO.Compression.ZipFile": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", + "dependencies": { + "System.Buffers": "4.3.0", + "System.IO": "4.3.0", + "System.IO.Compression": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.IO.FileSystem": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Linq": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + } + }, + "System.Linq.Expressions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Net.Http": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.DiagnosticSource": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Extensions": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.Net.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.OpenSsl": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Security.Cryptography.X509Certificates": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.Net.Http": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Net.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Net.Sockets": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Net.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.ObjectModel": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Reflection": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit.ILGeneration": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit.Lightweight": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Metadata": { + "type": "Transitive", + "resolved": "1.6.0", + "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" + }, + "System.Reflection.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.TypeExtensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Resources.ResourceManager": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "System.Runtime.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.Handles": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.InteropServices.RuntimeInformation": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0" + } + }, + "System.Runtime.Numerics": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", + "dependencies": { + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + } + }, + "System.Runtime.Serialization.Primitives": { + "type": "Transitive", + "resolved": "4.1.1", + "contentHash": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", + "dependencies": { + "System.Resources.ResourceManager": "4.0.1", + "System.Runtime": "4.1.0" + } + }, + "System.Security.Cryptography.Algorithms": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.Apple": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.Cng": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Security.Cryptography.Csp": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Security.Cryptography.Encoding": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Linq": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.OpenSsl": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", + "dependencies": { + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Security.Cryptography.X509Certificates": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Calendars": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Cng": "4.3.0", + "System.Security.Cryptography.Csp": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.OpenSsl": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.Net.Http": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Text.Encoding": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Text.RegularExpressions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Threading": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Threading.Tasks": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Threading.Timer": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Xml.ReaderWriter": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Tasks.Extensions": "4.3.0" + } + }, + "System.Xml.XDocument": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tools": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + } + }, + "xunit.abstractions": { + "type": "Transitive", + "resolved": "2.0.3", + "contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==" + }, + "xunit.analyzers": { + "type": "Transitive", + "resolved": "0.10.0", + "contentHash": "4/IDFCJfIeg6bix9apmUtIMwvOsiwqdEexeO/R2D4GReIGPLIRODTpId/l4LRSrAJk9lEO3Zx1H0Zx6uohJDNg==" + }, + "xunit.assert": { + "type": "Transitive", + "resolved": "2.4.1", + "contentHash": "O/Oe0BS5RmSsM+LQOb041TzuPo5MdH2Rov+qXGS37X+KFG1Hxz7kopYklM5+1Y+tRGeXrOx5+Xne1RuqLFQoyQ==", + "dependencies": { + "NETStandard.Library": "1.6.1" + } + }, + "xunit.core": { + "type": "Transitive", + "resolved": "2.4.1", + "contentHash": "Zsj5OMU6JasNGERXZy8s72+pcheG6Q15atS5XpZXqAtULuyQiQ6XNnUsp1gyfC6WgqScqMvySiEHmHcOG6Eg0Q==", + "dependencies": { + "xunit.extensibility.core": "[2.4.1]", + "xunit.extensibility.execution": "[2.4.1]" + } + }, + "xunit.extensibility.core": { + "type": "Transitive", + "resolved": "2.4.1", + "contentHash": "yKZKm/8QNZnBnGZFD9SewkllHBiK0DThybQD/G4PiAmQjKtEZyHi6ET70QPU9KtSMJGRYS6Syk7EyR2EVDU4Kg==", + "dependencies": { + "NETStandard.Library": "1.6.1", + "xunit.abstractions": "2.0.3" + } + }, + "xunit.extensibility.execution": { + "type": "Transitive", + "resolved": "2.4.1", + "contentHash": "7e/1jqBpcb7frLkB6XDrHCGXAbKN4Rtdb88epYxCSRQuZDRW8UtTfdTEVpdTl8s4T56e07hOBVd4G0OdCxIY2A==", + "dependencies": { + "NETStandard.Library": "1.6.1", + "xunit.extensibility.core": "[2.4.1]" + } + }, + "euler": { + "type": "Project" + } + } + } +} \ No newline at end of file diff --git a/csharp/Euler.Test/test.cs b/csharp/Euler.Test/test.cs new file mode 100644 index 00000000..125c3358 --- /dev/null +++ b/csharp/Euler.Test/test.cs @@ -0,0 +1,20 @@ +namespace Tests +{ + public class EulerTest + { + public static IEnumerable Data() + { + yield return new object[] { typeof(p0000), 0 }; + } + + [Theory] + [MemberData(nameof(Data))] + public async Task EulerTest_Problem(Type problem, Int64 expected) + { + IEuler? prob; + prob = (IEuler?)Activator.CreateInstance(problem); + Assert.NotNull(prob); + Assert.Equal(expected, await prob.Answer()); + } + } +} diff --git a/csharp/Euler/Euler.csproj b/csharp/Euler/Euler.csproj new file mode 100644 index 00000000..1f358d84 --- /dev/null +++ b/csharp/Euler/Euler.csproj @@ -0,0 +1,12 @@ + + + + net6.0 + enable + enable + Linux + . + true + + + diff --git a/csharp/Euler/p0000_template.cs b/csharp/Euler/p0000_template.cs new file mode 100644 index 00000000..f8f3b9b7 --- /dev/null +++ b/csharp/Euler/p0000_template.cs @@ -0,0 +1,16 @@ +using System; + +namespace Euler +{ + public interface IEuler + { + public Task Answer(); + } + public class p0000 : IEuler + { + public Task Answer() + { + return Task.FromResult(0); + } + } +} diff --git a/csharp/Euler/packages.lock.json b/csharp/Euler/packages.lock.json new file mode 100644 index 00000000..2fca7fd9 --- /dev/null +++ b/csharp/Euler/packages.lock.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "dependencies": { + "net6.0": {} + } +} \ No newline at end of file diff --git a/csharp/Makefile b/csharp/Makefile index 83c76c5d..13d5f358 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -7,3 +7,5 @@ test_%: dependencies dependencies: dotnet restore +lint: + dotnet format --verify-no-changes \ No newline at end of file diff --git a/csharp/README.md b/csharp/README.md index 3147bd94..b597edec 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -8,7 +8,7 @@ All C# files share a common prefix with their problem number. All shared functio ## Makefile -There are two main recipes in this Makefile +There are three main recipes in this Makefile ### dependencies @@ -18,6 +18,10 @@ This recipe installs all the required and test dependencies. See the Dependencie This recipe runs tests in multiple threads +### lint + +This recipe runs `dotnet`s builtin linter with the `--verify-no-changes` flag + ## Tests ### Prime Infrastructure Test diff --git a/csharp/csharp.sln b/csharp/csharp.sln new file mode 100644 index 00000000..bd9784bb --- /dev/null +++ b/csharp/csharp.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Euler", "Euler\Euler.csproj", "{109978C7-BB62-4A13-9B76-6E3B19F76071}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Euler.Test", "Euler.Test\Euler.Test.csproj", "{9DACCD2D-1AF9-43D7-BF6F-C9E286CCEBF2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {109978C7-BB62-4A13-9B76-6E3B19F76071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {109978C7-BB62-4A13-9B76-6E3B19F76071}.Debug|Any CPU.Build.0 = Debug|Any CPU + {109978C7-BB62-4A13-9B76-6E3B19F76071}.Release|Any CPU.ActiveCfg = Release|Any CPU + {109978C7-BB62-4A13-9B76-6E3B19F76071}.Release|Any CPU.Build.0 = Release|Any CPU + {9DACCD2D-1AF9-43D7-BF6F-C9E286CCEBF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DACCD2D-1AF9-43D7-BF6F-C9E286CCEBF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DACCD2D-1AF9-43D7-BF6F-C9E286CCEBF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DACCD2D-1AF9-43D7-BF6F-C9E286CCEBF2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/csharp/p0000_template.cs b/csharp/p0000_template.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/csharp/packages.lock.json b/csharp/packages.lock.json deleted file mode 100644 index e69de29b..00000000 diff --git a/csharp/test.cs b/csharp/test.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/javascript/Makefile b/javascript/Makefile index d8e50c5c..2693d7c3 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -39,3 +39,5 @@ _dependencies: npm install -g; endif +lint: + npx eslint *.js \ No newline at end of file From f26e763afcaae7bb0bf2d2a25887c3ea68c97aa3 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:35:52 -0500 Subject: [PATCH 037/326] Update js dependencies --- javascript/.eslintrc.json | 21 - javascript/eslint.config.mjs | 35 + javascript/package-lock.json | 2405 ++++++++++++++++++++++------------ javascript/package.json | 7 +- 4 files changed, 1580 insertions(+), 888 deletions(-) delete mode 100644 javascript/.eslintrc.json create mode 100644 javascript/eslint.config.mjs diff --git a/javascript/.eslintrc.json b/javascript/.eslintrc.json deleted file mode 100644 index db6d60a4..00000000 --- a/javascript/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es6": true - }, - "extends": [ - "google" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2018 - }, - "rules": { - "max-len": ["error", {"code": 120}], - "indent": ["error", 4] - } -} \ No newline at end of file diff --git a/javascript/eslint.config.mjs b/javascript/eslint.config.mjs new file mode 100644 index 00000000..496beacd --- /dev/null +++ b/javascript/eslint.config.mjs @@ -0,0 +1,35 @@ +import globals from "globals"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends("google"), { + languageOptions: { + globals: { + ...globals.browser, + ...globals.commonjs, + Atomics: "readonly", + SharedArrayBuffer: "readonly", + }, + + ecmaVersion: 2018, + sourceType: "script", + }, + + rules: { + "max-len": ["error", { + code: 120, + }], + + indent: ["error", 4], + }, +}]; \ No newline at end of file diff --git a/javascript/package-lock.json b/javascript/package-lock.json index 5116a232..bab7af15 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -1,316 +1,614 @@ { "name": "euler", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 3, "requires": true, - "dependencies": { - "@babel/code-frame": { + "packages": { + "": { + "name": "euler", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "benchmark": "^2.1.4", + "mocha": "^10.5.1" + }, + "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.5.0", + "eslint": "^6.4.0", + "eslint-config-google": "^0.14.0", + "globals": "^15.6.0" + } + }, + "node_modules/@babel/code-frame": { "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", "dev": true, - "requires": { + "dependencies": { "@babel/highlight": "^7.0.0" } }, - "@babel/highlight": { + "node_modules/@babel/highlight": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", "dev": true, - "requires": { + "dependencies": { "chalk": "^2.0.0", "esutils": "^2.0.2", "js-tokens": "^4.0.0" } }, - "acorn": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz", - "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==", + "node_modules/@eslint/eslintrc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/acorn": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "acorn-jsx": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz", - "integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==", + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/espree": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "dev": true, + "dependencies": { + "acorn": "^8.12.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "ajv": { + "node_modules/@eslint/js": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.5.0.tgz", + "integrity": "sha512-A7+AOT2ICkodvtsWnxZP4Xxk3NbZ3VMHd8oihydLRGrJgqqdEz1qSeEgXYyT/Cu8h1TWWsQRejIx48mtjZ5y1w==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "requires": { + "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" }, - "dependencies": { - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - } + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==" + "node_modules/ajv/node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "engines": { + "node": ">=6" + } }, - "ansi-escapes": { + "node_modules/ansi-escapes": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + "node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "ansi-styles": { + "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { + "dev": true, + "dependencies": { "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" } }, - "argparse": { + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "requires": { + "dev": true, + "dependencies": { "sprintf-js": "~1.0.2" } }, - "astral-regex": { + "node_modules/astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "balanced-match": { + "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, - "benchmark": { + "node_modules/benchmark": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", - "requires": { + "dependencies": { "lodash": "^4.17.4", "platform": "^1.3.3" } }, - "brace-expansion": { + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { + "dev": true, + "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "browser-stdout": { + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" }, - "callsites": { + "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "chalk": { + "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { + "dev": true, + "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "chardet": { + "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "cli-cursor": { + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, - "requires": { + "dependencies": { "restore-cursor": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "cli-width": { + "node_modules/cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" } }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } }, - "color-convert": { + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { + "dev": true, + "dependencies": { "color-name": "1.1.3" } }, - "color-name": { + "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, - "concat-map": { + "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, - "cross-spawn": { + "node_modules/cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "requires": { + "dev": true, + "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" } }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "deep-is": { + "node_modules/deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "engines": { + "node": ">=0.3.1" } }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" - }, - "doctrine": { + "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "requires": { + "dependencies": { "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" } }, - "emoji-regex": { + "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "requires": { - "once": "^1.4.0" - } - }, - "es-abstract": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.1.tgz", - "integrity": "sha512-cp/Tb1oA/rh2X7vqeSOvM+TSo3UkJLX70eNihgVEvnzwAgikjkTFr/QVgRCaxjm0knCNQzNoxxxcw2zO2LJdZA==", - "requires": { - "es-to-primitive": "^1.2.0", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.0", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-inspect": "^1.6.0", - "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.0.0", - "string.prototype.trimright": "^2.0.0" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "engines": { + "node": ">=6" } }, - "escape-string-regexp": { + "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } }, - "eslint": { + "node_modules/eslint": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz", "integrity": "sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA==", "dev": true, - "requires": { + "dependencies": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", "chalk": "^2.1.0", @@ -349,346 +647,451 @@ "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true - } + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" } }, - "eslint-config-google": { + "node_modules/eslint-config-google": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "eslint": ">=5.16.0" + } }, - "eslint-scope": { + "node_modules/eslint-scope": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", "dev": true, - "requires": { + "dependencies": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" } }, - "eslint-utils": { + "node_modules/eslint-utils": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz", "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==", "dev": true, - "requires": { + "dependencies": { "eslint-visitor-keys": "^1.0.0" + }, + "engines": { + "node": ">=6" } }, - "eslint-visitor-keys": { + "node_modules/eslint-visitor-keys": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "espree": { + "node_modules/eslint/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/espree": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz", "integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==", "dev": true, - "requires": { + "dependencies": { "acorn": "^7.0.0", "acorn-jsx": "^5.0.2", "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" } }, - "esprima": { + "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } }, - "esquery": { + "node_modules/esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", "dev": true, - "requires": { + "dependencies": { "estraverse": "^4.0.0" + }, + "engines": { + "node": ">=0.6" } }, - "esrecurse": { + "node_modules/esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, - "requires": { + "dependencies": { "estraverse": "^4.1.0" + }, + "engines": { + "node": ">=4.0" } }, - "estraverse": { + "node_modules/estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true + "dev": true, + "engines": { + "node": ">=4.0" + } }, - "esutils": { + "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "external-editor": { + "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, - "requires": { + "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" } }, - "fast-json-stable-stringify": { + "node_modules/fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, - "fast-levenshtein": { + "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "figures": { + "node_modules/figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, - "requires": { + "dependencies": { "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" } }, - "file-entry-cache": { + "node_modules/file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, - "requires": { + "dependencies": { "flat-cache": "^2.0.1" + }, + "engines": { + "node": ">=4" } }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "requires": { - "locate-path": "^3.0.0" + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "requires": { - "is-buffer": "~2.0.3" + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" } }, - "flat-cache": { + "node_modules/flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, - "requires": { + "dependencies": { "flatted": "^2.0.0", "rimraf": "2.6.3", "write": "1.0.3" + }, + "engines": { + "node": ">=4" } }, - "flatted": { + "node_modules/flatted": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, - "fs.realpath": { + "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } }, - "functional-red-black-tree": { + "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "get-caller-file": { + "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "requires": { - "pump": "^3.0.0" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" } }, - "glob": { + "node_modules/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "requires": { + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" } }, - "glob-parent": { + "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { + "dependencies": { "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" } }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" + "node_modules/globals": { + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.6.0.tgz", + "integrity": "sha512-UzcJi88Hw//CurUIRa9Jxb0vgOCcuD/MNjwmXp633cyaRKkCWACkoqHCtfZv43b1kqXGg/fpOa8bwgacCeXsVg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "has-flag": { + "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } }, - "he": { + "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "bin": { + "he": "bin/he" + } }, - "iconv-lite": { + "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, - "requires": { + "dependencies": { "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" } }, - "ignore": { + "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true + "dev": true, + "engines": { + "node": ">= 4" + } }, - "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, - "requires": { + "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "imurmurhash": { + "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true + "dev": true, + "engines": { + "node": ">=0.8.19" + } }, - "inflight": { + "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, - "inherits": { + "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "inquirer": { + "node_modules/inquirer": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", "dev": true, - "requires": { + "dependencies": { "ansi-escapes": "^3.2.0", "chalk": "^2.4.2", "cli-cursor": "^2.1.0", @@ -703,899 +1106,1171 @@ "strip-ansi": "^5.1.0", "through": "^2.3.6" }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "engines": { + "node": ">=6.0.0" } }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" - }, - "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + "node_modules/inquirer/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + "node_modules/inquirer/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } }, - "is-extglob": { + "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "engines": { + "node": ">=0.10.0" + } }, - "is-fullwidth-code-point": { + "node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } }, - "is-glob": { + "node_modules/is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { + "dependencies": { "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" } }, - "is-promise": { + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", "dev": true }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "requires": { - "has": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "requires": { - "has-symbols": "^1.0.0" + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "isexe": { + "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, - "js-tokens": { + "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, - "js-yaml": { + "node_modules/js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "requires": { + "dev": true, + "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "json-schema-traverse": { + "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify-without-jsonify": { + "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "requires": { - "invert-kv": "^2.0.0" - } - }, - "levn": { + "node_modules/levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "lodash": { + "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "requires": { - "chalk": "^2.0.1" + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "requires": { - "p-defer": "^1.0.0" + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "requires": { - "minimist": "0.0.8" + "node_modules/mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" } }, - "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", - "requires": { - "ansi-colors": "3.2.3", + "node_modules/mocha": { + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.5.1.tgz", + "integrity": "sha512-eq5tEnaz2kM9ade8cuGJBMh5fBb9Ih/TB+ddlmPR+wLQmwLhUwa0ovqDlg7OTfKquW0BI7NUcNWX7DH8sC+3gw==", + "dependencies": { + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", + "chokidar": "^3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "8.1.0", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "2.2.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "ms": "2.1.1", - "node-environment-flags": "1.0.5", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } }, - "mute-stream": { + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, - "natural-compare": { + "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nice-try": { + "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "object-inspect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", - "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" } }, - "once": { + "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { + "dependencies": { "wrappy": "1" } }, - "onetime": { + "node_modules/onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "dev": true, - "requires": { + "dependencies": { "mimic-fn": "^1.0.0" }, - "dependencies": { - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - } + "engines": { + "node": ">=4" } }, - "optionator": { + "node_modules/onetime/node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, - "requires": { + "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.4", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "wordwrap": "~1.0.0" + }, + "engines": { + "node": ">= 0.8.0" } }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, - "os-tmpdir": { + "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" - }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==" - }, - "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", - "requires": { - "p-try": "^2.0.0" + "dev": true, + "engines": { + "node": ">=0.10.0" } }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "requires": { - "p-limit": "^2.0.0" + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "parent-module": { + "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "requires": { + "dependencies": { "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } }, - "path-is-absolute": { + "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "path-key": { + "node_modules/path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true, + "engines": { + "node": ">=4" + } }, - "platform": { + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/platform": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.5.tgz", "integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q==" }, - "prelude-ls": { + "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.8.0" + } }, - "progress": { + "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "dev": true, + "engines": { + "node": ">=0.4.0" } }, - "punycode": { + "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "regexpp": { + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.5.0" + } }, - "require-directory": { + "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } }, - "resolve-from": { + "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "restore-cursor": { + "node_modules/restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", "dev": true, - "requires": { + "dependencies": { "onetime": "^2.0.0", "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=4" } }, - "rimraf": { + "node_modules/rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "requires": { + "dependencies": { "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" } }, - "run-async": { + "node_modules/run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, - "requires": { + "dependencies": { "is-promise": "^2.1.0" + }, + "engines": { + "node": ">=0.12.0" } }, - "rxjs": { + "node_modules/rxjs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", "dev": true, - "requires": { + "dependencies": { "tslib": "^1.9.0" - } + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "safer-buffer": { + "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dependencies": { + "randombytes": "^2.1.0" + } }, - "shebang-command": { + "node_modules/shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "requires": { + "dev": true, + "dependencies": { "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "shebang-regex": { + "node_modules/shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "signal-exit": { + "node_modules/signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true }, - "slice-ansi": { + "node_modules/slice-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, - "sprintf-js": { + "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, - "string-width": { + "node_modules/string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "requires": { + "dev": true, + "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" } }, - "string.prototype.trimleft": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.0.0.tgz", - "integrity": "sha1-aLaqjhYsaoDnbjqKDC50cYbicf8=", - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.0.2" - } - }, - "string.prototype.trimright": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.0.0.tgz", - "integrity": "sha1-q0pW2AKgH75yk+EehPJNyBZGYd0=", - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.0.2" - } - }, - "strip-ansi": { + "node_modules/strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { + "dev": true, + "dependencies": { "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "requires": { - "has-flag": "^3.0.0" + "node_modules/supports-color/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" } }, - "table": { + "node_modules/table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, - "requires": { + "dependencies": { "ajv": "^6.10.2", "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/table/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/table/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/table/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" } }, - "text-table": { + "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "through": { + "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, - "tmp": { + "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, - "requires": { + "dependencies": { "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" } }, - "tslib": { + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, - "type-check": { + "node_modules/type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "uri-js": { + "node_modules/uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, - "requires": { + "dependencies": { "punycode": "^2.1.0" } }, - "v8-compile-cache": { + "node_modules/v8-compile-cache": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", "dev": true }, - "which": { + "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { + "dev": true, + "dependencies": { "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" } }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wordwrap": { + "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, - "wrappy": { + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "write": { + "node_modules/write": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, - "requires": { + "dependencies": { "mkdirp": "^0.5.1" + }, + "engines": { + "node": ">=4" } }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==" - }, - "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", - "requires": { - "cliui": "^4.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - } + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" } }, - "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" } }, - "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } } } diff --git a/javascript/package.json b/javascript/package.json index 9a226850..e9aa38e9 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -10,10 +10,13 @@ "license": "ISC", "dependencies": { "benchmark": "^2.1.4", - "mocha": "^6.2.0" + "mocha": "^10.5.1" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.5.0", "eslint": "^6.4.0", - "eslint-config-google": "^0.14.0" + "eslint-config-google": "^0.14.0", + "globals": "^15.6.0" } } From 10ae0d0398e50af445652917dc9c7bc65113e1db Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:36:25 -0500 Subject: [PATCH 038/326] Update name --- javascript/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/package.json b/javascript/package.json index e9aa38e9..2381184e 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "Gabe Appleton", + "author": "Olivia Appleton", "license": "ISC", "dependencies": { "benchmark": "^2.1.4", From 17fdff63e519caa440e2761c5a477a5bf8af8d2e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:37:13 -0500 Subject: [PATCH 039/326] Add template comment from C solutions --- csharp/Euler/p0000_template.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/csharp/Euler/p0000_template.cs b/csharp/Euler/p0000_template.cs index f8f3b9b7..7df9c985 100644 --- a/csharp/Euler/p0000_template.cs +++ b/csharp/Euler/p0000_template.cs @@ -1,3 +1,12 @@ +/* +Project Euler Template + +This template is used to format Project Euler solution scripts. This paragraph +should be replaced by a description of how I approached the problem, as well as +critque. + +This paragraph should be replaced by the problem description, excluding images. +*/ using System; namespace Euler From f83310a8be722846eba8001c18205ab37e9127a3 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:45:52 -0500 Subject: [PATCH 040/326] Implement first problem; add timeout check --- csharp/Euler.Test/test.cs | 10 +++++++++- csharp/Euler/p0001.cs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 csharp/Euler/p0001.cs diff --git a/csharp/Euler.Test/test.cs b/csharp/Euler.Test/test.cs index 125c3358..4233e3fc 100644 --- a/csharp/Euler.Test/test.cs +++ b/csharp/Euler.Test/test.cs @@ -1,10 +1,14 @@ +using System.Diagnostics; + namespace Tests { public class EulerTest { + private readonly TimeSpan oneMinute = new TimeSpan(0, 1, 0); public static IEnumerable Data() { yield return new object[] { typeof(p0000), 0 }; + yield return new object[] { typeof(p0001), 233168 }; } [Theory] @@ -14,7 +18,11 @@ public async Task EulerTest_Problem(Type problem, Int64 expected) IEuler? prob; prob = (IEuler?)Activator.CreateInstance(problem); Assert.NotNull(prob); - Assert.Equal(expected, await prob.Answer()); + Stopwatch sw = Stopwatch.StartNew(); + Int64 result = await prob.Answer(); + sw.Stop(); + Assert.Equal(expected, result); + Assert.True(sw.Elapsed <= oneMinute); } } } diff --git a/csharp/Euler/p0001.cs b/csharp/Euler/p0001.cs new file mode 100644 index 00000000..0df6867e --- /dev/null +++ b/csharp/Euler/p0001.cs @@ -0,0 +1,33 @@ +/* +Project Euler Problem 1 + +I know that this could be done faster with a traditional for loop, but I wanted +to see if iterators were reasonably possible in C, since it makes the prime +number infrastructure a lot easier to set up. + +Problem: + +If we list all the natural numbers below 10 that are multiples of 3 or 5, we +get 3, 5, 6 and 9. The sum of these multiples is 23. + +Find the sum of all the multiples of 3 or 5 below 1000. +*/ +using System; + +namespace Euler +{ + public class p0001 : IEuler + { + public Task Answer() + { + int answer = 0; + for (int i = 0; i < 1000; i += 3) + answer += i; + for (int i = 0; i < 1000; i += 5) + answer += i; + for (int i = 0; i < 1000; i += 15) + answer -= i; + return Task.FromResult(answer); + } + } +} From dfa5ebc0233ef980055436886c081e6755ce1439 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 19:50:18 -0500 Subject: [PATCH 041/326] Disable gcc, optional tests on macos --- .github/workflows/on_push.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index ebb7b8b9..bda1eba2 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -187,8 +187,16 @@ jobs: # with: # platform: x64 - - name: Run tests + - name: Run tests (windows + linux) + if: ${{ !contains(matrix.os, 'macos') }} + run: make ctest + + - name: Run tests (macos) + if: ${{ contains(matrix.os, 'macos') }} run: make ctest + env: + NO_OPTIONAL_TESTS: true + COMPILER_OVERRIDE: clang csharp: strategy: From 4023a9facfb0aedb614364b4df8f9598974449a7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 20:06:59 -0500 Subject: [PATCH 042/326] make sure javascript grabs dependencies, disable c-lint --- .github/workflows/on_push.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index bda1eba2..092a98cd 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -83,7 +83,7 @@ jobs: cache-dependency-path: 'javascript/package-lock.json' - name: Fetch ESLint - run: npm install eslint-config-google@latest eslint@>=5.16.0 + run: make jsdependencies; npm install eslint-config-google@latest eslint@>=5.16.0 - name: Lint run: make jslint @@ -139,19 +139,22 @@ jobs: cache: 'npm' cache-dependency-path: 'javascript/package-lock.json' + - name: Install dependencies + run: make jsdependencies + - name: Run tests run: make jstest - c-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup clang-tidy - run: sudo apt-get install -y clang-tidy - - - name: Run tests - run: make clint +# c-lint: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# +# - name: Setup clang-tidy +# run: sudo apt-get install -y clang-tidy +# +# - name: Run tests +# run: make clint c: strategy: @@ -241,4 +244,4 @@ jobs: - name: Run Linter run: make cslint - \ No newline at end of file + From f785d3373516b10b585d6066a08b5cd69bd4b199 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 20:13:29 -0500 Subject: [PATCH 043/326] =?UTF-8?q?disable=20fail-fast,=20nodejs=20?= =?UTF-8?q?=E2=89=A510?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_push.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 092a98cd..44bcd68f 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -22,6 +22,7 @@ jobs: python: strategy: + fail-fast: false matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] @@ -90,16 +91,11 @@ jobs: javascript: strategy: + fail-fast: false matrix: - version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + version: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] os: [ubuntu-latest, windows-latest, macos-latest] exclude: - - os: macos-latest - version: 8 - - os: macos-latest - version: 9 - - os: macos-latest - version: 10 - os: macos-latest version: 11 - os: macos-latest @@ -111,12 +107,6 @@ jobs: - os: macos-latest version: 15 include: - - os: macos-13 - version: 8 - - os: macos-13 - version: 9 - - os: macos-13 - version: 10 - os: macos-13 version: 11 - os: macos-13 @@ -158,6 +148,7 @@ jobs: c: strategy: + fail-fast: false matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, From 4caeb4141f6d81df94206951ba2c8432c28f34e7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 20:45:51 -0500 Subject: [PATCH 044/326] disable javascript 11, remove csharp linux default --- .github/workflows/on_push.yml | 15 ++++++++++----- csharp/Euler.Test/Euler.Test.csproj | 2 -- csharp/Euler/Euler.csproj | 2 -- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 44bcd68f..a0745ac9 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -93,11 +93,9 @@ jobs: strategy: fail-fast: false matrix: - version: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + version: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] os: [ubuntu-latest, windows-latest, macos-latest] exclude: - - os: macos-latest - version: 11 - os: macos-latest version: 12 - os: macos-latest @@ -107,8 +105,6 @@ jobs: - os: macos-latest version: 15 include: - - os: macos-13 - version: 11 - os: macos-13 version: 12 - os: macos-13 @@ -210,6 +206,15 @@ jobs: - name: Setup .NET ${{ matrix.net_version }} uses: actions/setup-dotnet@v3 + if: ${{ matrix.version > 6 }} + with: + dotnet-version: ${{ matrix.net_version }},6 + cache: true + cache-dependency-path: 'csharp/*/packages.lock.json' + + - name: Setup .NET ${{ matrix.net_version }} + uses: actions/setup-dotnet@v3 + if: ${{ matrix.version <= 6 }} with: dotnet-version: ${{ matrix.net_version }} cache: true diff --git a/csharp/Euler.Test/Euler.Test.csproj b/csharp/Euler.Test/Euler.Test.csproj index 52c4cc33..1672bcef 100644 --- a/csharp/Euler.Test/Euler.Test.csproj +++ b/csharp/Euler.Test/Euler.Test.csproj @@ -4,8 +4,6 @@ net6.0 enable enable - Linux - . true false diff --git a/csharp/Euler/Euler.csproj b/csharp/Euler/Euler.csproj index 1f358d84..dd047d0e 100644 --- a/csharp/Euler/Euler.csproj +++ b/csharp/Euler/Euler.csproj @@ -4,8 +4,6 @@ net6.0 enable enable - Linux - . true From 0db1304306f80b643c58ef18a3606af0988a92b8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 21:01:16 -0500 Subject: [PATCH 045/326] restrict csharp to ubuntu+* and {macos,windows}+6 --- .github/workflows/on_push.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index a0745ac9..2ac41879 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -193,12 +193,14 @@ jobs: fail-fast: false matrix: net_version: [5, 6, 7, 8] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] include: - - net_version: 8 + - net_version: 6 os: macos-latest - - net_version: 8 + - net_version: 6 os: macos-13 + - net_version: 6 + os: windows-latest runs-on: ${{ matrix.os }} steps: @@ -206,15 +208,6 @@ jobs: - name: Setup .NET ${{ matrix.net_version }} uses: actions/setup-dotnet@v3 - if: ${{ matrix.version > 6 }} - with: - dotnet-version: ${{ matrix.net_version }},6 - cache: true - cache-dependency-path: 'csharp/*/packages.lock.json' - - - name: Setup .NET ${{ matrix.net_version }} - uses: actions/setup-dotnet@v3 - if: ${{ matrix.version <= 6 }} with: dotnet-version: ${{ matrix.net_version }} cache: true @@ -240,4 +233,4 @@ jobs: - name: Run Linter run: make cslint - + From c24e45c813563bed1cb2ba2d977a21a8214acf04 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 21:08:51 -0500 Subject: [PATCH 046/326] revert eslint changes --- javascript/.eslintrc | 21 +++++++++++++++++++++ javascript/eslint.config.mjs | 35 ----------------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) create mode 100644 javascript/.eslintrc delete mode 100644 javascript/eslint.config.mjs diff --git a/javascript/.eslintrc b/javascript/.eslintrc new file mode 100644 index 00000000..cb94c5a3 --- /dev/null +++ b/javascript/.eslintrc @@ -0,0 +1,21 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es6": true + }, + "extends": [ + "google" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018 + }, + "rules": { + "max-len": ["error", {"code": 120}], + "indent": ["error", 4] + } +} diff --git a/javascript/eslint.config.mjs b/javascript/eslint.config.mjs deleted file mode 100644 index 496beacd..00000000 --- a/javascript/eslint.config.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import globals from "globals"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all -}); - -export default [...compat.extends("google"), { - languageOptions: { - globals: { - ...globals.browser, - ...globals.commonjs, - Atomics: "readonly", - SharedArrayBuffer: "readonly", - }, - - ecmaVersion: 2018, - sourceType: "script", - }, - - rules: { - "max-len": ["error", { - code: 120, - }], - - indent: ["error", 4], - }, -}]; \ No newline at end of file From 408870d24053b775d2e0bf4108550824b3a9b3ff Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 21:50:46 -0500 Subject: [PATCH 047/326] submodules --- .github/workflows/on_push.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 2ac41879..d33cffc7 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -131,16 +131,18 @@ jobs: - name: Run tests run: make jstest -# c-lint: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# -# - name: Setup clang-tidy -# run: sudo apt-get install -y clang-tidy -# -# - name: Run tests -# run: make clint + c-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup clang-tidy + run: sudo apt-get install -y clang-tidy + + - name: Run tests + run: make clint c: strategy: @@ -158,6 +160,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: true - name: Use Python 3.10 uses: actions/setup-python@v5 From 62c2c77021d623485c05ae04579f8b8d7ba60113 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 25 Jun 2024 22:37:56 -0500 Subject: [PATCH 048/326] Only upgrade most warnings to error --- c/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/Makefile b/c/Makefile index 0b2ce0d3..905e70a7 100644 --- a/c/Makefile +++ b/c/Makefile @@ -25,7 +25,7 @@ dependencies: lint: if test -z "$(clang-tidy p0000_template.c -warnings-as-errors=* 2>&1 | grep "Unknown command line argument")"; then \ - clang-tidy *.c -warnings-as-errors=*; \ + clang-tidy *.c -warnings-as-errors=-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling; \ else \ clang-tidy *.c; \ fi @@ -58,4 +58,4 @@ icc: echo '{"selections":[{"moduleId":"intel_cpp_compiler"},{"moduleId":"intel_threading_building_blocks","isDependencyTool":true}]}' > packages.json; \ sudo ./install.sh -s silent.cfg; \ PATH="/opt/intel/system_studio_2019/bin${PATH:+:${PATH}}"; export PATH -endif \ No newline at end of file +endif From b0a40253f0a3b2c8a52109c1f535a8a80609a7e7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 00:05:56 -0500 Subject: [PATCH 049/326] Split workflows by language, make badges --- .github/workflows/c.yml | 66 +++++++++ .github/workflows/csharp.yml | 51 +++++++ .github/workflows/javascript.yml | 65 +++++++++ .github/workflows/on_push.yml | 240 ------------------------------- .github/workflows/python.yml | 72 ++++++++++ README.md | 5 + 6 files changed, 259 insertions(+), 240 deletions(-) create mode 100644 .github/workflows/c.yml create mode 100644 .github/workflows/csharp.yml create mode 100644 .github/workflows/javascript.yml delete mode 100644 .github/workflows/on_push.yml create mode 100644 .github/workflows/python.yml diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml new file mode 100644 index 00000000..3a3ffd66 --- /dev/null +++ b/.github/workflows/c.yml @@ -0,0 +1,66 @@ +name: C Check + +on: push + +jobs: + c-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup clang-tidy + run: sudo apt-get install -y clang-tidy + + - name: Run tests + run: make clint + + c: + strategy: + fail-fast: false + matrix: +# compiler: ["llvm", "gcc"] +# # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, + os: [ubuntu-latest, windows-latest, macos-latest, macos-13] +# include: +# - os: windows-latest +# compiler: msvc +# - os: windows-latest +# compiler: mingw + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Use Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache-dependency-path: c/requirements.txt + +# - name: Setup Cpp ${{ matrix.compiler }} +# uses: aminya/setup-cpp@v1 +# if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} +# with: +# compiler: ${{ matrix.compiler }} + +# - name: Set up MinGW +# uses: egor-tensin/setup-mingw@v2 +# if: ${{ matrix.compiler == 'mingw' }} +# with: +# platform: x64 + + - name: Run tests (windows + linux) + if: ${{ !contains(matrix.os, 'macos') }} + run: make ctest + + - name: Run tests (macos) + if: ${{ contains(matrix.os, 'macos') }} + run: make ctest + env: + NO_OPTIONAL_TESTS: true + COMPILER_OVERRIDE: clang + diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml new file mode 100644 index 00000000..0299d8d1 --- /dev/null +++ b/.github/workflows/csharp.yml @@ -0,0 +1,51 @@ +name: C# Check + +on: push + +jobs: + csharp: + strategy: + fail-fast: false + matrix: + net_version: [5, 6, 7, 8] + os: [ubuntu-latest] + include: + - net_version: 6 + os: macos-latest + - net_version: 6 + os: macos-13 + - net_version: 6 + os: windows-latest + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET ${{ matrix.net_version }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.net_version }} + cache: true + cache-dependency-path: 'csharp/*/packages.lock.json' + + - name: Dependencies + run: make csdependencies + + - name: Run Tests + run: make cstest + + csharp-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8 + cache: true + cache-dependency-path: 'csharp/*/packages.lock.json' + + - name: Run Linter + run: make cslint + diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml new file mode 100644 index 00000000..af47483d --- /dev/null +++ b/.github/workflows/javascript.yml @@ -0,0 +1,65 @@ +name: JavaScript Check + +on: push + +jobs: + javascript-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 22 + uses: actions/setup-node@v3 + with: + node-version: 22 + cache: 'npm' + cache-dependency-path: 'javascript/package-lock.json' + + - name: Fetch ESLint + run: make jsdependencies; npm install eslint-config-google@latest eslint@>=5.16.0 + + - name: Lint + run: make jslint + + javascript: + strategy: + fail-fast: false + matrix: + version: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + os: [ubuntu-latest, windows-latest, macos-latest] + exclude: + - os: macos-latest + version: 12 + - os: macos-latest + version: 13 + - os: macos-latest + version: 14 + - os: macos-latest + version: 15 + include: + - os: macos-13 + version: 12 + - os: macos-13 + version: 13 + - os: macos-13 + version: 14 + - os: macos-13 + version: 15 + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.version }} + cache: 'npm' + cache-dependency-path: 'javascript/package-lock.json' + + - name: Install dependencies + run: make jsdependencies + + - name: Run tests + run: make jstest + diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml deleted file mode 100644 index d33cffc7..00000000 --- a/.github/workflows/on_push.yml +++ /dev/null @@ -1,240 +0,0 @@ -name: Euler Regression Check - -on: push - -jobs: -# python-lint: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# -# - name: Use Python 3.12 -# uses: actions/setup-python@v5 -# with: -# python-version: 3.12 -# cache: 'pip' -# cache-dependency-path: | -# python/requirements.txt -# c/requirements.txt -# -# - name: Lint -# run: make pytest LINT=only - - python: - strategy: - fail-fast: false - matrix: - version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, windows-latest] - exclude: - - os: ubuntu-latest - version: 3.6 - - os: macos-13 - version: 3.11 - - os: macos-13 - version: 3.12 - include: - - os: ubuntu-20.04 - version: 3.6 - - os: macos-latest - version: 3.11 - - os: macos-latest - version: 3.12 - - os: ubuntu-latest - version: graalpy-23.1 - - os: macos-latest - version: 3.12 - - os: macos-13 - version: 3.12 - - os: ubuntu-latest - version: graalpy-24.0 - - os: ubuntu-latest - version: pypy3.8 - - os: ubuntu-latest - version: pypy3.9 - - os: ubuntu-latest - version: pypy3.10 - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - - name: Use Python ${{ matrix.version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.version }} - cache: 'pip' - cache-dependency-path: | - python/requirements.txt - c/requirements.txt - - - name: Run tests - run: make pytest LINT=false - - javascript-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 22 - uses: actions/setup-node@v3 - with: - node-version: 22 - cache: 'npm' - cache-dependency-path: 'javascript/package-lock.json' - - - name: Fetch ESLint - run: make jsdependencies; npm install eslint-config-google@latest eslint@>=5.16.0 - - - name: Lint - run: make jslint - - javascript: - strategy: - fail-fast: false - matrix: - version: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] - os: [ubuntu-latest, windows-latest, macos-latest] - exclude: - - os: macos-latest - version: 12 - - os: macos-latest - version: 13 - - os: macos-latest - version: 14 - - os: macos-latest - version: 15 - include: - - os: macos-13 - version: 12 - - os: macos-13 - version: 13 - - os: macos-13 - version: 14 - - os: macos-13 - version: 15 - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.version }} - cache: 'npm' - cache-dependency-path: 'javascript/package-lock.json' - - - name: Install dependencies - run: make jsdependencies - - - name: Run tests - run: make jstest - - c-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Setup clang-tidy - run: sudo apt-get install -y clang-tidy - - - name: Run tests - run: make clint - - c: - strategy: - fail-fast: false - matrix: -# compiler: ["llvm", "gcc"] -# # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, - os: [ubuntu-latest, windows-latest, macos-latest, macos-13] -# include: -# - os: windows-latest -# compiler: msvc -# - os: windows-latest -# compiler: mingw - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Use Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - cache-dependency-path: c/requirements.txt - -# - name: Setup Cpp ${{ matrix.compiler }} -# uses: aminya/setup-cpp@v1 -# if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} -# with: -# compiler: ${{ matrix.compiler }} - -# - name: Set up MinGW -# uses: egor-tensin/setup-mingw@v2 -# if: ${{ matrix.compiler == 'mingw' }} -# with: -# platform: x64 - - - name: Run tests (windows + linux) - if: ${{ !contains(matrix.os, 'macos') }} - run: make ctest - - - name: Run tests (macos) - if: ${{ contains(matrix.os, 'macos') }} - run: make ctest - env: - NO_OPTIONAL_TESTS: true - COMPILER_OVERRIDE: clang - - csharp: - strategy: - fail-fast: false - matrix: - net_version: [5, 6, 7, 8] - os: [ubuntu-latest] - include: - - net_version: 6 - os: macos-latest - - net_version: 6 - os: macos-13 - - net_version: 6 - os: windows-latest - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - - name: Setup .NET ${{ matrix.net_version }} - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ matrix.net_version }} - cache: true - cache-dependency-path: 'csharp/*/packages.lock.json' - - - name: Dependencies - run: make csdependencies - - - name: Run Tests - run: make cstest - - csharp-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup .NET 8 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8 - cache: true - cache-dependency-path: 'csharp/*/packages.lock.json' - - - name: Run Linter - run: make cslint - diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 00000000..41875c0a --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,72 @@ +name: Python Check + +on: push + +jobs: +# python-lint: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# +# - name: Use Python 3.12 +# uses: actions/setup-python@v5 +# with: +# python-version: 3.12 +# cache: 'pip' +# cache-dependency-path: | +# python/requirements.txt +# c/requirements.txt +# +# - name: Lint +# run: make pytest LINT=only + + python: + strategy: + fail-fast: false + matrix: + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-latest, windows-latest] + exclude: + - os: ubuntu-latest + version: 3.6 + - os: macos-13 + version: 3.11 + - os: macos-13 + version: 3.12 + include: + - os: ubuntu-20.04 + version: 3.6 + - os: macos-latest + version: 3.11 + - os: macos-latest + version: 3.12 + - os: ubuntu-latest + version: graalpy-23.1 + - os: macos-latest + version: 3.12 + - os: macos-13 + version: 3.12 + - os: ubuntu-latest + version: graalpy-24.0 + - os: ubuntu-latest + version: pypy3.8 + - os: ubuntu-latest + version: pypy3.9 + - os: ubuntu-latest + version: pypy3.10 + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Use Python ${{ matrix.version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.version }} + cache: 'pip' + cache-dependency-path: | + python/requirements.txt + c/requirements.txt + + - name: Run tests + run: make pytest LINT=false diff --git a/README.md b/README.md index 362ed2b5..9481b3d1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # LivInTheLookingGlass's Project Euler solutions +Build Status: +- C: [![C Build Status](actions/workflows/c.yml/badge.svg)](actions/workflows/c.yml) +- C#: [![C# Build Status](actions/workflows/csharp.yml/badge.svg)](actions/workflows/csharp.yml) +- JavaScript: [![JavaScript Build Status](actions/workflows/javascript.yml/badge.svg)](actions/workflows/javascript.yml) +- Python: [![Python Build Status](actions/workflows/python.yml/badge.svg)](actions/workflows/python.yml) This is the repository I keep for prospective employers to look at project Euler code that I have written. This is useful because it has defined problems and answers such that you can compare answers with other people. From 909d577ffefb7ebce6d5b913af9ab7b3576f5e98 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 00:13:37 -0500 Subject: [PATCH 050/326] fix/add badges --- README.md | 11 ++++++----- c/README.md | 2 ++ csharp/README.md | 2 ++ javascript/README.md | 6 ++++-- python/README.md | 2 ++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9481b3d1..3695ca95 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # LivInTheLookingGlass's Project Euler solutions Build Status: -- C: [![C Build Status](actions/workflows/c.yml/badge.svg)](actions/workflows/c.yml) -- C#: [![C# Build Status](actions/workflows/csharp.yml/badge.svg)](actions/workflows/csharp.yml) -- JavaScript: [![JavaScript Build Status](actions/workflows/javascript.yml/badge.svg)](actions/workflows/javascript.yml) -- Python: [![Python Build Status](actions/workflows/python.yml/badge.svg)](actions/workflows/python.yml) +- C: [![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) +- C#: [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) +- JavaScript: [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) +- Python: [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) + This is the repository I keep for prospective employers to look at project Euler code that I have written. This is useful because it has defined problems and answers such that you can compare answers with other people. -All solutions are tested against multiple operating systems and language/compiler versions. For more information, see `.github/workflows/on_push.yml` +All solutions are tested against multiple operating systems and language/compiler versions. For more information, see `.github/workflows/` ## This is NOT meant to help others on Project Euler problems diff --git a/c/README.md b/c/README.md index 4b16bd7d..186a595b 100644 --- a/c/README.md +++ b/c/README.md @@ -1,5 +1,7 @@ # C Section +Build Status: [![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) + All problems are solved in C11, though most if not all of it is C99-compatible. It is tested on clang, gcc, and cl (the Visual Studios compiler). ## Organization diff --git a/csharp/README.md b/csharp/README.md index b597edec..da4baadb 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -1,5 +1,7 @@ # C# Section +Build Status: [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) + All problems are solved in .NET 6, though an effort is made to support other versions. ## Organization diff --git a/javascript/README.md b/javascript/README.md index d47319a6..0e11b29c 100644 --- a/javascript/README.md +++ b/javascript/README.md @@ -1,4 +1,6 @@ -# Javascript Section +# JavaScript Section + +Build Status: [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) All problems are solved in ES6+ Javascript @@ -30,4 +32,4 @@ A test fails if it gets the wrong answer or if it takes more than 1 minute. ## Dependencies -I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. \ No newline at end of file +I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. diff --git a/python/README.md b/python/README.md index 13138b33..88ed2e6b 100644 --- a/python/README.md +++ b/python/README.md @@ -1,5 +1,7 @@ # Python Section +Build Status: [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) + All problems are solved in type-hinted python3 ## Organization From fdd709d60679ab52304843ad32e9825a342df5b6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 18:15:58 -0500 Subject: [PATCH 051/326] Update badge placement --- README.md | 6 +----- c/README.md | 2 +- csharp/README.md | 2 +- javascript/README.md | 2 +- python/README.md | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3695ca95..dbc68341 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # LivInTheLookingGlass's Project Euler solutions -Build Status: -- C: [![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) -- C#: [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) -- JavaScript: [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) -- Python: [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) +[![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) This is the repository I keep for prospective employers to look at project Euler code that I have written. diff --git a/c/README.md b/c/README.md index 186a595b..2e873f0f 100644 --- a/c/README.md +++ b/c/README.md @@ -1,6 +1,6 @@ # C Section -Build Status: [![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) +[![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) All problems are solved in C11, though most if not all of it is C99-compatible. It is tested on clang, gcc, and cl (the Visual Studios compiler). diff --git a/csharp/README.md b/csharp/README.md index da4baadb..46a90047 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -1,6 +1,6 @@ # C# Section -Build Status: [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) +[![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) All problems are solved in .NET 6, though an effort is made to support other versions. diff --git a/javascript/README.md b/javascript/README.md index 0e11b29c..d267803a 100644 --- a/javascript/README.md +++ b/javascript/README.md @@ -1,6 +1,6 @@ # JavaScript Section -Build Status: [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) +[![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) All problems are solved in ES6+ Javascript diff --git a/python/README.md b/python/README.md index 88ed2e6b..4617fc8f 100644 --- a/python/README.md +++ b/python/README.md @@ -1,6 +1,6 @@ # Python Section -Build Status: [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) +[![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) All problems are solved in type-hinted python3 From 5743bf28f012824fe61f5f37d2c4f54cc95bf8b0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 18:17:08 -0500 Subject: [PATCH 052/326] Add attempt at native build for unity tests --- c/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/c/Makefile b/c/Makefile index 905e70a7..e88da2ab 100644 --- a/c/Makefile +++ b/c/Makefile @@ -59,3 +59,6 @@ icc: sudo ./install.sh -s silent.cfg; \ PATH="/opt/intel/system_studio_2019/bin${PATH:+:${PATH}}"; export PATH endif + +native: + $(CC) *.c Unity/src/unity.c $(CFLAGS) From 5713a88336719c713536a84847ebe821053e1ff0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 17:17:03 -0500 Subject: [PATCH 053/326] Create codeql.yml --- .github/workflows/codeql.yml | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..1fcfe065 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,94 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '29 10 * * 4' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + # required to fetch internal or private CodeQL packs + packages: read + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + build-mode: manual + - language: csharp + build-mode: none + - language: javascript-typescript + build-mode: none + - language: python + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: ${{ matrix.language == 'c-cpp' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' && matrix.language == 'c-cpp' + shell: bash + run: | + make cnative + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 05193c9537b38530c7e67589073a206b393e9078 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 19:16:17 -0500 Subject: [PATCH 054/326] Fix up `make cnative` --- c/Makefile | 2 +- c/p0014.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c/Makefile b/c/Makefile index e88da2ab..48f567fb 100644 --- a/c/Makefile +++ b/c/Makefile @@ -61,4 +61,4 @@ icc: endif native: - $(CC) *.c Unity/src/unity.c $(CFLAGS) + $(CC) test.c Unity/src/unity.c -O2 -lm -Wall -Werror -std=c11 -march=native -flto -DAMD_COMPILER=0 diff --git a/c/p0014.c b/c/p0014.c index 0e5243ae..b8e9c4d6 100644 --- a/c/p0014.c +++ b/c/p0014.c @@ -30,7 +30,7 @@ static unsigned int collatz_len_cache[CACHE_SIZE] = {0, 1, 0}; unsigned int collatz_len(unsigned long long n); -inline unsigned int collatz_len(unsigned long long n) { +unsigned int collatz_len(unsigned long long n) { if (n < CACHE_SIZE && collatz_len_cache[n]) { return collatz_len_cache[n]; } From 284c95226533852c6be4c6658b2381abcb685f15 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 19:53:23 -0500 Subject: [PATCH 055/326] further pretty up README --- .github/workflows/c.yml | 2 +- .github/workflows/csharp.yml | 2 +- .github/workflows/javascript.yml | 2 +- .github/workflows/python.yml | 2 +- README.md | 8 +++++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 3a3ffd66..32fd3e0f 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -1,4 +1,4 @@ -name: C Check +name: C on: push diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 0299d8d1..c0a59180 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -1,4 +1,4 @@ -name: C# Check +name: C# on: push diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index af47483d..1e978d7b 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -1,4 +1,4 @@ -name: JavaScript Check +name: JavaScript on: push diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 41875c0a..4e20e33b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,4 +1,4 @@ -name: Python Check +name: Python on: push diff --git a/README.md b/README.md index dbc68341..2a4c5ff2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # LivInTheLookingGlass's Project Euler solutions -[![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) [![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) [![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) [![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) +| **Language** | **Solved** | **Status** | +|-----------------------|----|------------| +| C (C11+) | 18 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | +| C# (5+) | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | +| JavaScript (Node 12+) | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | +| Python (3.6+) | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | +| CodeQL Scanning || [![CodeQL](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml) | This is the repository I keep for prospective employers to look at project Euler code that I have written. From 72a00448b035f15e107bb786411eebb89e81bc4a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 20:22:31 -0500 Subject: [PATCH 056/326] Further prettification --- .github/workflows/javascript.yml | 2 +- README.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 1e978d7b..abbdc30c 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -1,4 +1,4 @@ -name: JavaScript +name: JS on: push diff --git a/README.md b/README.md index 2a4c5ff2..e188c9fd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # LivInTheLookingGlass's Project Euler solutions -| **Language** | **Solved** | **Status** | -|-----------------------|----|------------| -| C (C11+) | 18 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | -| C# (5+) | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | -| JavaScript (Node 12+) | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | -| Python (3.6+) | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | -| CodeQL Scanning || [![CodeQL](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml) | +| Language | Version | Solved | Status | +|:---------|:--------|:-------|:-------| +| C | C11+ | 18 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | +| C# | 5+ | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | +| JavaScript | Node 12+ | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | +| Python | CPython 3.6+
Pypy 3.8+
GraalPy 23.1+ | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | +| CodeQL Scanning ||| [![CodeQL](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml) | This is the repository I keep for prospective employers to look at project Euler code that I have written. From 3237a786da68b13005fdb8982a0c219c9c68cc0f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 20:52:15 -0500 Subject: [PATCH 057/326] Speed up c, python tests --- .github/workflows/c.yml | 18 ++++++++++++------ .github/workflows/python.yml | 2 +- c/Makefile | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 32fd3e0f..4b7ad00b 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -22,7 +22,7 @@ jobs: matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, - os: [ubuntu-latest, windows-latest, macos-latest, macos-13] + os: [ubuntu-latest, windows-latest, macos-latest, macos-13, ubuntu-20.04] # include: # - os: windows-latest # compiler: msvc @@ -39,7 +39,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" - cache-dependency-path: c/requirements.txt + cache-dependency-path: | + c/requirements.txt + python/requirements.txt # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 @@ -53,13 +55,17 @@ jobs: # with: # platform: x64 - - name: Run tests (windows + linux) - if: ${{ !contains(matrix.os, 'macos') }} - run: make ctest + - name: Run tests (linux) + if: ${{ contains(matrix.os, 'ubuntu') }} + run: make ctest${{ matrix.os == 'ubuntu-latest' && '_auto' }} + + - name: Run tests (windows) + if: ${{ contains(matrix.os == 'windows') }} + run: make ctest_auto - name: Run tests (macos) if: ${{ contains(matrix.os, 'macos') }} - run: make ctest + run: make ctest_auto env: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 4e20e33b..5ad35815 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -69,4 +69,4 @@ jobs: c/requirements.txt - name: Run tests - run: make pytest LINT=false + run: make pytest${{ (!contains(matrix.os, 'latest') || matrix.version != '3.12') && '_auto LINT=false' }} diff --git a/c/Makefile b/c/Makefile index 48f567fb..a69617ba 100644 --- a/c/Makefile +++ b/c/Makefile @@ -13,6 +13,7 @@ endif endif test_%: dependencies + cd ../python; $(MAKE) dependencies $(MFLAGS) $(PY) -m pytest -vl -n$* test_euler.py test: dependencies From db5b078db1039929856aa2df1360772f4c9557fe Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 20:54:27 -0500 Subject: [PATCH 058/326] fix syntax error --- .github/workflows/c.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 4b7ad00b..a32590fd 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -22,7 +22,7 @@ jobs: matrix: # compiler: ["llvm", "gcc"] # # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, - os: [ubuntu-latest, windows-latest, macos-latest, macos-13, ubuntu-20.04] + os: [ubuntu-latest, windows-latest, macos-latest, macos-13, 'ubuntu-20.04'] # include: # - os: windows-latest # compiler: msvc @@ -39,9 +39,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" - cache-dependency-path: | - c/requirements.txt - python/requirements.txt + cache-dependency-path: '*/requirements.txt' # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 @@ -60,7 +58,7 @@ jobs: run: make ctest${{ matrix.os == 'ubuntu-latest' && '_auto' }} - name: Run tests (windows) - if: ${{ contains(matrix.os == 'windows') }} + if: ${{ contains(matrix.os, 'windows') }} run: make ctest_auto - name: Run tests (macos) From ff0fe04333ccc3b6841ad35e0c4e2a146ce6c074 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 20:56:39 -0500 Subject: [PATCH 059/326] fix logic error --- .github/workflows/c.yml | 2 +- .github/workflows/python.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index a32590fd..1f11071c 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -55,7 +55,7 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make ctest${{ matrix.os == 'ubuntu-latest' && '_auto' }} + run: make ctest${{ (matrix.os == 'ubuntu-latest' && '_auto') || '' }} - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5ad35815..18605582 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -69,4 +69,4 @@ jobs: c/requirements.txt - name: Run tests - run: make pytest${{ (!contains(matrix.os, 'latest') || matrix.version != '3.12') && '_auto LINT=false' }} + run: make pytest${{ ((!contains(matrix.os, 'latest') || matrix.version != '3.12') && '_auto LINT=false') || '' }} From 902e2887481cfc0cd4b329a662d98a2682eadd29 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 21:07:58 -0500 Subject: [PATCH 060/326] disable xdist on graalpy --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 18605582..1a77c735 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -69,4 +69,4 @@ jobs: c/requirements.txt - name: Run tests - run: make pytest${{ ((!contains(matrix.os, 'latest') || matrix.version != '3.12') && '_auto LINT=false') || '' }} + run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12') && '_auto LINT=false') || '' }} From f11fafa41d33da79d2c5d2ed16ecb342d7ed1213 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 21:09:25 -0500 Subject: [PATCH 061/326] syntax error --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 1a77c735..acde4044 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -69,4 +69,4 @@ jobs: c/requirements.txt - name: Run tests - run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12') && '_auto LINT=false') || '' }} + run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12')) && '_auto LINT=false') || '' }} From 04056fead7c163ad19228921bd3da0a11813e34e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 21:40:42 -0500 Subject: [PATCH 062/326] fix graalpy patch --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index acde4044..b8f8f275 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -69,4 +69,4 @@ jobs: c/requirements.txt - name: Run tests - run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12')) && '_auto LINT=false') || '' }} + run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12') && '_auto LINT=false')) || '' }} From d49ffcdea1eda834e83678aabd8614c646b8a75c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 22:12:30 -0500 Subject: [PATCH 063/326] fix parallel vs serial (hopefully) --- .github/workflows/python.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b8f8f275..43934032 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -68,5 +68,10 @@ jobs: python/requirements.txt c/requirements.txt - - name: Run tests - run: make pytest${{ ((!contains(matrix.os, 'latest') || (!contains(matrix.version, 'graalpy') || matrix.version != '3.12') && '_auto LINT=false')) || '' }} + - name: Run tests (serially) + if: (matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy') + run: make pytest + + - name: Run tests (in parallel) + if: !((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')) + run: make pytest_auto From 9cda09860bd17919a5fb8a24a7769b1293d9c0d5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 22:17:06 -0500 Subject: [PATCH 064/326] iterate --- .github/workflows/python.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 43934032..37743a82 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -26,24 +26,18 @@ jobs: matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] - exclude: - - os: ubuntu-latest - version: 3.6 - - os: macos-13 - version: 3.11 - - os: macos-13 - version: 3.12 +# exclude: +# - os: ubuntu-latest +# version: 3.6 include: - - os: ubuntu-20.04 - version: 3.6 - os: macos-latest version: 3.11 - os: macos-latest version: 3.12 - os: ubuntu-latest version: graalpy-23.1 - - os: macos-latest - version: 3.12 + - os: macos-13 + version: 3.11 - os: macos-13 version: 3.12 - os: ubuntu-latest @@ -69,9 +63,9 @@ jobs: c/requirements.txt - name: Run tests (serially) - if: (matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy') + if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} run: make pytest - name: Run tests (in parallel) - if: !((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')) + if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} run: make pytest_auto From a8cc06696c16cfacbaf65eaf531eeff7bf6178d1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 22:22:17 -0500 Subject: [PATCH 065/326] rework some build logic --- .github/workflows/c.yml | 2 +- .github/workflows/python.yml | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 1f11071c..0fe9ae54 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -55,7 +55,7 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make ctest${{ (matrix.os == 'ubuntu-latest' && '_auto') || '' }} + run: make ctest${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 37743a82..479c98dc 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -26,10 +26,12 @@ jobs: matrix: version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] -# exclude: -# - os: ubuntu-latest -# version: 3.6 + exclude: + - os: ubuntu-latest + version: 3.6 include: + - os: ubuntu-20.04 + version: 3.6 - os: macos-latest version: 3.11 - os: macos-latest @@ -64,8 +66,8 @@ jobs: - name: Run tests (serially) if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} - run: make pytest + run: make pytest LINT=false - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} - run: make pytest_auto + run: make pytest_auto LINT=false From bc7840953086a19381953a62281ed055ffd12583 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 23:21:16 -0500 Subject: [PATCH 066/326] Add problems solved section --- README.md | 2 +- c/README.md | 28 ++++++++++++++++- csharp/README.md | 4 +++ javascript/README.md | 5 +++ python/README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e188c9fd..410e1d39 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | Language | Version | Solved | Status | |:---------|:--------|:-------|:-------| -| C | C11+ | 18 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | +| C | C11+
gcc, clang | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | | C# | 5+ | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | | JavaScript | Node 12+ | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | | Python | CPython 3.6+
Pypy 3.8+
GraalPy 23.1+ | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | diff --git a/c/README.md b/c/README.md index 2e873f0f..de40c1b9 100644 --- a/c/README.md +++ b/c/README.md @@ -10,7 +10,7 @@ All C files share a common prefix with their problem number. All shared function ## Makefile -There are three main recipes in this Makefile +There are four main recipes in this Makefile ### dependencies @@ -24,6 +24,10 @@ This recipe runs tests in a single thread and performs benchmarks on each. This This recipe runs tests in multiple threads, using however many are specified by the number after the _. For example, `test_3` would spawn three python processes. Because benchmark disables itself when running in children processes, benchmark info is not available with this recipe. +### native + +This recipe builds a test executable using the Unity test framework. It recycles no Python infrastructure, but consequently cannot test some features like compiler macros and deterministic building. + ## Tests ### Compiler Detection Macros @@ -87,3 +91,25 @@ If this variable is defined to something other than 0 or an empty string, proble ### ONLY_SLOW If this variable is defined to something other than 0 or an empty string, *only* problems in the known_slow group will be tested. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. + +## Problems Solved + +- [x] [1](./p0001.c) +- [x] [2](./p0002.c) +- [x] [3](./p0003.c) +- [x] [4](./p0004.c) +- [x] [5](./p0005.c) +- [x] [6](./p0006.c) +- [x] [7](./p0007.c) +- [x] [8](./p0008.c) +- [x] [9](./p0009.c) +- [x] [10](./p0010.c) +- [x] [11](./p0011.c) +- [ ] [12](./p0012.c) +- [x] [13](./p0013.c) +- [x] [14](./p0014.c) +- [x] [15](./p0015.c) +- [x] [16](./p0016.c) +- [x] [34](./p0034.c) +- [x] [76](./p0076.c) + diff --git a/csharp/README.md b/csharp/README.md index 46a90047..315cac51 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -45,3 +45,7 @@ A test fails if it gets the wrong answer or if it takes more than 1 minute. ## Dependencies I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. + +## Problems Solved + +- [x] [1](./p0001.cs) diff --git a/javascript/README.md b/javascript/README.md index d267803a..223e01c6 100644 --- a/javascript/README.md +++ b/javascript/README.md @@ -33,3 +33,8 @@ A test fails if it gets the wrong answer or if it takes more than 1 minute. ## Dependencies I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. + +## Problems Solved + +- [x] [1](./p0001.js) +- [x] [2](./p0002.js) diff --git a/python/README.md b/python/README.md index 4617fc8f..8c617c01 100644 --- a/python/README.md +++ b/python/README.md @@ -79,3 +79,75 @@ If this variable is defined to something other than 0 or an empty string, proble ### ONLY_SLOW If this variable is defined to something other than 0 or an empty string, *only* problems in the known_slow group will be tested. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. +## Problems Solved + +- [x] [1](./p0001.py) +- [x] [2](./p0002.py) +- [x] [3](./p0003.py) +- [x] [4](./p0004.py) +- [x] [5](./p0005.py) +- [x] [6](./p0006.py) +- [x] [7](./p0007.py) +- [x] [8](./p0008.py) +- [x] [9](./p0009.py) +- [x] [10](./p0010.py) +- [x] [11](./p0011.py) +- [x] [12](./p0012.py) +- [x] [13](./p0013.py) +- [x] [14](./p0014.py) +- [x] [15](./p0015.py) +- [x] [16](./p0016.py) +- [x] [17](./p0017.py) +- [x] [18](./p0018.py) +- [x] [19](./p0019.py) +- [x] [20](./p0020.py) +- [x] [21](./p0021.py) +- [x] [22](./p0022.py) +- [x] [23](./p0023.py) +- [x] [24](./p0024.py) +- [x] [25](./p0025.py) +- [x] [27](./p0027.py) +- [x] [29](./p0029.py) +- [x] [30](./p0030.py) +- [x] [31](./p0031.py) +- [x] [32](./p0032.py) +- [x] [33](./p0033.py) +- [x] [34](./p0034.py) +- [x] [35](./p0035.py) +- [x] [36](./p0036.py) +- [x] [37](./p0037.py) +- [x] [38](./p0038.py) +- [x] [39](./p0039.py) +- [x] [40](./p0040.py) +- [x] [41](./p0041.py) +- [x] [42](./p0042.py) +- [x] [43](./p0043.py) +- [x] [44](./p0044.py) +- [x] [45](./p0045.py) +- [x] [46](./p0046.py) +- [x] [47](./p0047.py) +- [x] [48](./p0048.py) +- [x] [49](./p0049.py) +- [x] [50](./p0050.py) +- [x] [52](./p0052.py) +- [x] [53](./p0053.py) +- [x] [55](./p0055.py) +- [x] [56](./p0056.py) +- [x] [57](./p0057.py) +- [x] [59](./p0059.py) +- [x] [67](./p0067.py) +- [x] [69](./p0069.py) +- [x] [71](./p0071.py) +- [x] [73](./p0073.py) +- [x] [74](./p0074.py) +- [x] [76](./p0076.py) +- [x] [77](./p0077.py) +- [x] [87](./p0087.py) +- [x] [92](./p0092.py) +- [x] [98](./p0098.py) +- [x] [118](./p0118.py) +- [x] [123](./p0123.py) +- [x] [134](./p0134.py) +- [x] [145](./p0145.py) +- [x] [187](./p0187.py) +- [x] [206](./p0206.py) From 9040408717ad12236e45e18c7bdd3027ac3c343d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 23:27:34 -0500 Subject: [PATCH 067/326] Add tcc, pcc tests back to workflpw --- .github/workflows/c.yml | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 0fe9ae54..d8174c6d 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -41,6 +41,10 @@ jobs: python-version: "3.10" cache-dependency-path: '*/requirements.txt' + - name: Setup tcc, pcc + if: ${{ contains(matrix.os, 'ubuntu') }} + run: sudo apt-get install -y tcc pcc + # - name: Setup Cpp ${{ matrix.compiler }} # uses: aminya/setup-cpp@v1 # if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} diff --git a/README.md b/README.md index 410e1d39..49b040dd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | Language | Version | Solved | Status | |:---------|:--------|:-------|:-------| -| C | C11+
gcc, clang | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | +| C | C11+
clang, gcc,
pcc, tcc | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | | C# | 5+ | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | | JavaScript | Node 12+ | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | | Python | CPython 3.6+
Pypy 3.8+
GraalPy 23.1+ | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | From be8b9810954f2e991acfe8c142a06433eea8c0af Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 26 Jun 2024 23:58:57 -0500 Subject: [PATCH 068/326] don't install pcc on ubuntu-20.04, where it is broken --- .github/workflows/c.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index d8174c6d..aa074fa8 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -42,7 +42,7 @@ jobs: cache-dependency-path: '*/requirements.txt' - name: Setup tcc, pcc - if: ${{ contains(matrix.os, 'ubuntu') }} + if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install -y tcc pcc # - name: Setup Cpp ${{ matrix.compiler }} From b1d9d9b84812b7377044947e18ee590d4a901577 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 27 Jun 2024 00:08:05 -0500 Subject: [PATCH 069/326] Add MSVC to windows c test --- .github/workflows/c.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index aa074fa8..90b4da56 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -45,15 +45,16 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install -y tcc pcc -# - name: Setup Cpp ${{ matrix.compiler }} -# uses: aminya/setup-cpp@v1 -# if: ${{ contains(matrix.compiler, fromJSON('["llvm", "gcc", "msvc"]')) }} -# with: -# compiler: ${{ matrix.compiler }} + - name: Setup MSVC + uses: aminya/setup-cpp@v1 + if: ${{ contains(matrix.os, 'windows') }} + with: + compiler: msvc + vcvarsall: true # - name: Set up MinGW +# if: ${{ contains(matrix.os, 'windows') }} # uses: egor-tensin/setup-mingw@v2 -# if: ${{ matrix.compiler == 'mingw' }} # with: # platform: x64 From a42b9e6572859cd0d4b8fa8773e13d73c9610eb5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 27 Jun 2024 00:17:04 -0500 Subject: [PATCH 070/326] Update compiler list [no ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49b040dd..568bf3a9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | Language | Version | Solved | Status | |:---------|:--------|:-------|:-------| -| C | C11+
clang, gcc,
pcc, tcc | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | +| C | C11+
gcc, pcc, tcc
clang, msvc | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | | C# | 5+ | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | | JavaScript | Node 12+ | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | | Python | CPython 3.6+
Pypy 3.8+
GraalPy 23.1+ | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | From 4a3c314a56a20093c0c8de65e1a3b7bdfafaa629 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 27 Jun 2024 00:25:36 -0500 Subject: [PATCH 071/326] Delete last vestigaes of prvious CI [no vi] --- .scripts/shippable_script.sh | 59 ------------------------------------ c/Makefile | 30 ------------------ 2 files changed, 89 deletions(-) delete mode 100644 .scripts/shippable_script.sh diff --git a/.scripts/shippable_script.sh b/.scripts/shippable_script.sh deleted file mode 100644 index d55148d6..00000000 --- a/.scripts/shippable_script.sh +++ /dev/null @@ -1,59 +0,0 @@ -set -e; -if [ $pyver ]; then - if [ $linter ]; then - make pytest LINT=true PY=python USER_FLAG= - else - export PY_EXE=python - if [ $py36 ]; then - sudo add-apt-repository -y ppa:jonathonf/python-3.6 - sudo apt-get update --fix-missing - sudo apt-get install python3.6 - virtualenv -p python3.6 venv - export PY_EXE=$PWD/venv/bin/python - fi - make pytest LINT=false PY=$PY_EXE USER_FLAG= MYPY= - fi -elif [ $jsver ]; then - if [ $linter ]; then - make jsdependencies - cd javascript; - npm install eslint-config-google@latest eslint@>=5.16.0; - npx eslint *.js && echo "Linting successful!" - else - make jstest - fi -else - sudo apt-get update - if [ $pcc ]; then - sudo apt-get install -y build-essential flex bison - mkdir pcc pcc-libs - wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-1.1.0.tgz | tar -xz --no-seek -C pcc --strip-components=1 - wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-libs-1.1.0.tgz | tar -xz --no-seek -C pcc-libs --strip-components=1 - cd pcc - sed -i 's/MANPAGE=@BINPREFIX@cpp/MANPAGE=@BINPREFIX@pcc-cpp/' cc/cpp/Makefile.in - ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu - sudo make && sudo make install - cd ../pcc-libs - ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu - sudo make && sudo make install - cd .. - elif [ $icc ]; then - mkdir iccdir - wget -O - -o /dev/null https://registrationcenter-download.intel.com/akdlm/irc_nas/15873/intel-sw-tools-installer.tar.gz | tar -xz --no-seek -C iccdir --strip-components=1 - cd iccdir - sudo apt-get update - sudo apt-get install -y cpio - sed -i -e "s/ACCEPT_EULA=decline/ACCEPT_EULA=accept/g" silent.cfg - sed -i -e "s/ACTIVATION_TYPE=no_license/ACTIVATION_TYPE=serial_number/g" silent.cfg - echo "ACTIVATION_SERIAL_NUMBER=CKDX-WNDG7BK7" >> silent.cfg - echo "SELECTION_CONFIG_FILES_PATH=$PWD/packages.json" >> silent.cfg - echo '{"selections":[{"moduleId":"intel_cpp_compiler"},{"moduleId":"intel_threading_building_blocks","isDependencyTool":true}]}' > packages.json - sudo ./install.sh -s silent.cfg - PATH="/opt/intel/system_studio_2019/bin${PATH:+:${PATH}}" - export PATH - cd .. - else - sudo apt-get install -y $COMPILER_OVERRIDE python3-pip - fi - cd c && make test USER_FLAG= -fi diff --git a/c/Makefile b/c/Makefile index a69617ba..d3b3d784 100644 --- a/c/Makefile +++ b/c/Makefile @@ -31,35 +31,5 @@ lint: clang-tidy *.c; \ fi -ifeq ($(OS),Windows_NT) -else -pcc: - sudo apt-get install -y build-essential flex bison - mkdir pcc pcc-libs - wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-1.1.0.tgz | tar -xz --no-seek -C pcc --strip-components=1 - wget -O - -o /dev/null http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-libs-1.1.0.tgz | tar -xz --no-seek -C pcc-libs --strip-components=1 - cd pcc; \ - sed -i 's/MANPAGE=@BINPREFIX@cpp/MANPAGE=@BINPREFIX@pcc-cpp/' cc/cpp/Makefile.in; \ - ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu; \ - sudo make && sudo make install; \ - cd ../pcc-libs; \ - ./configure --prefix=/usr --libexecdir=/usr/lib/{x86_64,i386}-linux-gnu; \ - sudo make && sudo make install - -icc: - mkdir iccdir - wget -O - -o /dev/null https://registrationcenter-download.intel.com/akdlm/irc_nas/15873/intel-sw-tools-installer.tar.gz | tar -xz --no-seek -C iccdir --strip-components=1 - sudo apt-get update - sudo apt-get install -y cpio - cd iccdir; \ - sed -i -e "s/ACCEPT_EULA=decline/ACCEPT_EULA=accept/g" silent.cfg; \ - sed -i -e "s/ACTIVATION_TYPE=no_license/ACTIVATION_TYPE=serial_number/g" silent.cfg; \ - echo "ACTIVATION_SERIAL_NUMBER=CKDX-WNDG7BK7" >> silent.cfg; \ - echo "SELECTION_CONFIG_FILES_PATH=$PWD/packages.json" >> silent.cfg; \ - echo '{"selections":[{"moduleId":"intel_cpp_compiler"},{"moduleId":"intel_threading_building_blocks","isDependencyTool":true}]}' > packages.json; \ - sudo ./install.sh -s silent.cfg; \ - PATH="/opt/intel/system_studio_2019/bin${PATH:+:${PATH}}"; export PATH -endif - native: $(CC) test.c Unity/src/unity.c -O2 -lm -Wall -Werror -std=c11 -march=native -flto -DAMD_COMPILER=0 From ab9cc1ded1a7efa5bb4ead3455312af5972da070 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 27 Jun 2024 19:57:38 -0500 Subject: [PATCH 072/326] add file that will eventually build docs --- .github/workflows/pages.yml.pending | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pages.yml.pending diff --git a/.github/workflows/pages.yml.pending b/.github/workflows/pages.yml.pending new file mode 100644 index 00000000..d723b9de --- /dev/null +++ b/.github/workflows/pages.yml.pending @@ -0,0 +1,39 @@ +name: Pages + +on: push + +jobs: + build: + runs-on: 'ubuntu-latest' + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - uses: ammaraskar/sphinx-action@master + with: + docs-folder: "docs/" + build-command: "make html" + + - uses: actions/upload-pages-artifact + with: + path: docs/_build/html/ + + deploy: + needs: build + runs-on: ubuntu-latest + + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + From 6334b615a493d5b706ae51cd926937f500aa1acb Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 28 Jun 2024 18:16:04 -0500 Subject: [PATCH 073/326] Prep for building documentation Python is easy Next step is C, Then JavaScript, Then C# Hopefully I don't need to scrape comments and do it manually --- .../{pages.yml.pending => pages.yml} | 10 + .gitignore | 3 +- Makefile | 3 + README.md | 28 --- README.rst | 62 ++++++ c/README.md | 115 ---------- c/README.rst | 200 +++++++++++++++++ csharp/README.md | 51 ----- csharp/README.rst | 80 +++++++ docs/Makefile | 36 +++ docs/c.rst | 12 + docs/conf.py | 54 +++++ docs/csharp.rst | 12 + docs/index.rst | 29 +++ docs/javascript.rst | 12 + docs/python.rst | 83 +++++++ docs/python/p0001.rst | 8 + docs/python/p0002.rst | 8 + docs/python/p0003.rst | 8 + docs/python/p0004.rst | 8 + docs/python/p0005.rst | 8 + docs/python/p0006.rst | 8 + docs/python/p0007.rst | 8 + docs/python/p0008.rst | 8 + docs/python/p0009.rst | 8 + docs/python/p0010.rst | 8 + docs/python/p0011.rst | 8 + docs/python/p0012.rst | 8 + docs/python/p0013.rst | 8 + docs/python/p0014.rst | 8 + docs/python/p0015.rst | 8 + docs/python/p0016.rst | 8 + docs/python/p0017.rst | 8 + docs/python/p0018.rst | 8 + docs/python/p0019.rst | 8 + docs/python/p0020.rst | 8 + docs/python/p0021.rst | 8 + docs/python/p0022.rst | 8 + docs/python/p0023.rst | 8 + docs/python/p0024.rst | 8 + docs/python/p0025.rst | 8 + docs/python/p0027.rst | 8 + docs/python/p0029.rst | 8 + docs/python/p0030.rst | 8 + docs/python/p0031.rst | 8 + docs/python/p0032.rst | 8 + docs/python/p0033.rst | 8 + docs/python/p0034.rst | 8 + docs/python/p0035.rst | 8 + docs/python/p0036.rst | 8 + docs/python/p0037.rst | 8 + docs/python/p0038.rst | 8 + docs/python/p0039.rst | 8 + docs/python/p0040.rst | 8 + docs/python/p0041.rst | 8 + docs/python/p0042.rst | 8 + docs/python/p0043.rst | 8 + docs/python/p0044.rst | 8 + docs/python/p0045.rst | 8 + docs/python/p0046.rst | 8 + docs/python/p0047.rst | 8 + docs/python/p0048.rst | 8 + docs/python/p0049.rst | 8 + docs/python/p0050.rst | 8 + docs/python/p0052.rst | 8 + docs/python/p0053.rst | 8 + docs/python/p0055.rst | 8 + docs/python/p0056.rst | 8 + docs/python/p0057.rst | 8 + docs/python/p0059.rst | 8 + docs/python/p0067.rst | 8 + docs/python/p0069.rst | 8 + docs/python/p0071.rst | 8 + docs/python/p0073.rst | 8 + docs/python/p0074.rst | 8 + docs/python/p0076.rst | 8 + docs/python/p0077.rst | 8 + docs/python/p0087.rst | 8 + docs/python/p0092.rst | 8 + docs/python/p0097.rst | 8 + docs/python/p0118.rst | 8 + docs/python/p0123.rst | 8 + docs/python/p0134.rst | 8 + docs/python/p0145.rst | 8 + docs/python/p0187.rst | 8 + docs/python/p0206.rst | 8 + docs/requirements.txt | 3 + docs/usage.rst | 11 + javascript/README.md | 40 ---- javascript/README.rst | 64 ++++++ python/README.md | 153 ------------- python/README.rst | 209 ++++++++++++++++++ python/p0012.py | 2 + python/p0018.py | 42 ++-- python/p0027.py | 10 +- 95 files changed, 1472 insertions(+), 412 deletions(-) rename .github/workflows/{pages.yml.pending => pages.yml} (74%) delete mode 100644 README.md create mode 100644 README.rst delete mode 100644 c/README.md create mode 100644 c/README.rst delete mode 100644 csharp/README.md create mode 100644 csharp/README.rst create mode 100644 docs/Makefile create mode 100644 docs/c.rst create mode 100644 docs/conf.py create mode 100644 docs/csharp.rst create mode 100644 docs/index.rst create mode 100644 docs/javascript.rst create mode 100644 docs/python.rst create mode 100644 docs/python/p0001.rst create mode 100644 docs/python/p0002.rst create mode 100644 docs/python/p0003.rst create mode 100644 docs/python/p0004.rst create mode 100644 docs/python/p0005.rst create mode 100644 docs/python/p0006.rst create mode 100644 docs/python/p0007.rst create mode 100644 docs/python/p0008.rst create mode 100644 docs/python/p0009.rst create mode 100644 docs/python/p0010.rst create mode 100644 docs/python/p0011.rst create mode 100644 docs/python/p0012.rst create mode 100644 docs/python/p0013.rst create mode 100644 docs/python/p0014.rst create mode 100644 docs/python/p0015.rst create mode 100644 docs/python/p0016.rst create mode 100644 docs/python/p0017.rst create mode 100644 docs/python/p0018.rst create mode 100644 docs/python/p0019.rst create mode 100644 docs/python/p0020.rst create mode 100644 docs/python/p0021.rst create mode 100644 docs/python/p0022.rst create mode 100644 docs/python/p0023.rst create mode 100644 docs/python/p0024.rst create mode 100644 docs/python/p0025.rst create mode 100644 docs/python/p0027.rst create mode 100644 docs/python/p0029.rst create mode 100644 docs/python/p0030.rst create mode 100644 docs/python/p0031.rst create mode 100644 docs/python/p0032.rst create mode 100644 docs/python/p0033.rst create mode 100644 docs/python/p0034.rst create mode 100644 docs/python/p0035.rst create mode 100644 docs/python/p0036.rst create mode 100644 docs/python/p0037.rst create mode 100644 docs/python/p0038.rst create mode 100644 docs/python/p0039.rst create mode 100644 docs/python/p0040.rst create mode 100644 docs/python/p0041.rst create mode 100644 docs/python/p0042.rst create mode 100644 docs/python/p0043.rst create mode 100644 docs/python/p0044.rst create mode 100644 docs/python/p0045.rst create mode 100644 docs/python/p0046.rst create mode 100644 docs/python/p0047.rst create mode 100644 docs/python/p0048.rst create mode 100644 docs/python/p0049.rst create mode 100644 docs/python/p0050.rst create mode 100644 docs/python/p0052.rst create mode 100644 docs/python/p0053.rst create mode 100644 docs/python/p0055.rst create mode 100644 docs/python/p0056.rst create mode 100644 docs/python/p0057.rst create mode 100644 docs/python/p0059.rst create mode 100644 docs/python/p0067.rst create mode 100644 docs/python/p0069.rst create mode 100644 docs/python/p0071.rst create mode 100644 docs/python/p0073.rst create mode 100644 docs/python/p0074.rst create mode 100644 docs/python/p0076.rst create mode 100644 docs/python/p0077.rst create mode 100644 docs/python/p0087.rst create mode 100644 docs/python/p0092.rst create mode 100644 docs/python/p0097.rst create mode 100644 docs/python/p0118.rst create mode 100644 docs/python/p0123.rst create mode 100644 docs/python/p0134.rst create mode 100644 docs/python/p0145.rst create mode 100644 docs/python/p0187.rst create mode 100644 docs/python/p0206.rst create mode 100644 docs/requirements.txt create mode 100644 docs/usage.rst delete mode 100644 javascript/README.md create mode 100644 javascript/README.rst delete mode 100644 python/README.md create mode 100644 python/README.rst diff --git a/.github/workflows/pages.yml.pending b/.github/workflows/pages.yml similarity index 74% rename from .github/workflows/pages.yml.pending rename to .github/workflows/pages.yml index d723b9de..568b1fbb 100644 --- a/.github/workflows/pages.yml.pending +++ b/.github/workflows/pages.yml @@ -11,6 +11,16 @@ jobs: with: submodules: true + - name: Use Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + cache: 'pip' + cache-dependency-path: | + python/requirements.txt + c/requirements.txt + docs/requirements.txt + - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" diff --git a/.gitignore b/.gitignore index 5862b85a..fe0b1aa9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ venv/** **.pdb csharp/*/obj csharp/*/bin -**/TestResults \ No newline at end of file +**/TestResults +docs/_build \ No newline at end of file diff --git a/Makefile b/Makefile index f7ea1dd3..31c52d1b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ PY?=python3 PROXY?= +html: + cd docs && $(make) $(MFLAGS) + py%: cd python && $(MAKE) $* $(MFLAGS) diff --git a/README.md b/README.md deleted file mode 100644 index 568bf3a9..00000000 --- a/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# LivInTheLookingGlass's Project Euler solutions - -| Language | Version | Solved | Status | -|:---------|:--------|:-------|:-------| -| C | C11+
gcc, pcc, tcc
clang, msvc | 17 | [![C](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) | -| C# | 5+ | 1 | [![C#](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) | -| JavaScript | Node 12+ | 2 | [![JavaScript](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) | -| Python | CPython 3.6+
Pypy 3.8+
GraalPy 23.1+ | 70 | [![Python](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) | -| CodeQL Scanning ||| [![CodeQL](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml) | - -This is the repository I keep for prospective employers to look at project Euler code that I have written. - -This is useful because it has defined problems and answers such that you can compare answers with other people. - -All solutions are tested against multiple operating systems and language/compiler versions. For more information, see `.github/workflows/` - -## This is NOT meant to help others on Project Euler problems - -## If you are working on Project Euler problems, DO NOT use this as a source - -The repo is divided into sections for each language. The top-level Makefile will direct recipes using prefixes - -- `make c*` will go to the c Makefile -- `make cs*` will go to the csharp Makefile -- `make py*` will go to the python Makefile -- `make js*` will go to the javascript Makefile - -For more information, please see the README documents in each section. diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..1ae50162 --- /dev/null +++ b/README.rst @@ -0,0 +1,62 @@ +LivInTheLookingGlass’s Project Euler solutions +============================================== + +.. |C| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml +.. |C#| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml +.. |JavaScript| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml +.. |Python| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml +.. |CodeQL| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml +.. |br| raw:: html + +
+.. |total| replace:: 642 + ++------------+---------------------+--------------+--------------+ +| Language | Version | Solved | Status | ++============+=====================+==============+==============+ +| C | C11+ in: |br| | 17 / |total| | |C| | +| | ``gcc``, ``pcc``, | | | +| | ``tcc``, |br| | | | +| | ``clang``, ``msvc`` | | | ++------------+---------------------+--------------+--------------+ +| C# | .NET 5+ | 1 / |total| | |C#| | ++------------+---------------------+--------------+--------------+ +| JavaScript | Node 12+ | 2 / |total| | |JavaScript| | ++------------+---------------------+--------------+--------------+ +| Python | CPython 3.6+ |br| | 70 / |total| | |Python| | +| | Pypy 3.8+ |br| | | | +| | GraalPy 23.1+ | | | ++------------+---------------------+--------------+--------------+ +| CodeQL Scanning | |CodeQL| | ++-------------------------------------------------+--------------+ + +This is the repository I keep for prospective employers to look at +project Euler code that I have written. + +This is useful because it has defined problems and answers such that you +can compare answers with other people. + +All solutions are tested against multiple operating systems and +language/compiler versions. For more information, see +``.github/workflows/`` + +This is NOT meant to help others on Project Euler problems +---------------------------------------------------------- + +If you are working on Project Euler problems, DO NOT use this as a source +------------------------------------------------------------------------- + +The repo is divided into sections for each language. The top-level +Makefile will direct recipes using prefixes + +- ``make c*`` will go to the c Makefile +- ``make cs*`` will go to the csharp Makefile +- ``make py*`` will go to the python Makefile +- ``make js*`` will go to the javascript Makefile + +For more information, please see the README documents in each section. \ No newline at end of file diff --git a/c/README.md b/c/README.md deleted file mode 100644 index de40c1b9..00000000 --- a/c/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# C Section - -[![C Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml) - -All problems are solved in C11, though most if not all of it is C99-compatible. It is tested on clang, gcc, and cl (the Visual Studios compiler). - -## Organization - -All C files share a common prefix with their problem number. All shared functions are moved to header files in the include subfolder - -## Makefile - -There are four main recipes in this Makefile - -### dependencies - -This recipe installs all the required and test dependencies. See the Dependencies section for more info - -### test - -This recipe runs tests in a single thread and performs benchmarks on each. This test infrastructure is recycled from the python section. - -### test_* - -This recipe runs tests in multiple threads, using however many are specified by the number after the _. For example, `test_3` would spawn three python processes. Because benchmark disables itself when running in children processes, benchmark info is not available with this recipe. - -### native - -This recipe builds a test executable using the Unity test framework. It recycles no Python infrastructure, but consequently cannot test some features like compiler macros and deterministic building. - -## Tests - -### Compiler Detection Macros - -There are a set of macros which detect which compiler is being used. These macros are mostly used to route around issues with particular compilers. For instance, PCC does not allow me to include `` or `` on the systems I've tested it on, so I need to route around that. This test checks that those macros are correct. - -### Prime Infrastructure Test - -This test checks five things: - -1. It checks `is_prime()` for numbers up to `MAX_PRIME`, where that is defined in the test -2. It checks that `is_composite()` returns truthy values on composites in that range, and falsey values on primes -3. It checks that `is_composite()` returns the smallest prime factor on composite numbers -4. It checks that the prime numbers are generated in the correct order -5. It checks that all these operations are completed in less than 200ns * `MAX_PRIME` - -### Generic Problems - -For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will run it as many times as the benchmark plugin wants. Otherwise it is run exactly once. - -A test fails if it gets the wrong answer or if it takes more than 1 minute. - -## Dependencies - -I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. - -Note that there are optional test that leverage the Python infrastructure. If you want these tests to work you need to go to the python folder and run `make dependencies` or define the [`NO_OPTIONAL_TESTS`](#no-slow-tests) environment variable. - -## Environment Variables - -### COMPILER_OVERRIDE - -If this variable is defined, it should contain a comma-separated list of the compilers you would like to test from the following list (case insensitive): - -* aocc (AMD Optimized C Compiler) -* cl (Visual Studios compiler) -* clang -* gcc -* icc (Intel C Compiler) -* pcc (Portable C Compiler) -* tcc (Tiny C Compiler) - -If this variable is not defined, compilers will be auto-detected using `which()`. - -### AOCC_OVERRIDE - -If this variable is defined, it should hold a string representing the AMD compiler binary you would like to use. One case you may want this in is to test both the AMD compiler and traditional clang by renaming the AMD compiler's executable. - -### GCC_OVERRIDE - -If this variable is defined, it should hold a string representing the `gcc` binary you would like to use. One case you may want this in is on OSX or Termux, where `gcc` is often remapped to `clang`. - -### NO_OPTIONAL_TESTS - -If this variable is defined to something other than 0 or an empty string, the test suite will skip any tests which are not directly related to Project Euler problems. This value will default to the same value as [`ONLY_SLOW`](#only-slow). - -### NO_SLOW - -If this variable is defined to something other than 0 or an empty string, problems in the known_slow group will not be tested. This variable defaults to True on Termux systems. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. - -### ONLY_SLOW - -If this variable is defined to something other than 0 or an empty string, *only* problems in the known_slow group will be tested. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. - -## Problems Solved - -- [x] [1](./p0001.c) -- [x] [2](./p0002.c) -- [x] [3](./p0003.c) -- [x] [4](./p0004.c) -- [x] [5](./p0005.c) -- [x] [6](./p0006.c) -- [x] [7](./p0007.c) -- [x] [8](./p0008.c) -- [x] [9](./p0009.c) -- [x] [10](./p0010.c) -- [x] [11](./p0011.c) -- [ ] [12](./p0012.c) -- [x] [13](./p0013.c) -- [x] [14](./p0014.c) -- [x] [15](./p0015.c) -- [x] [16](./p0016.c) -- [x] [34](./p0034.c) -- [x] [76](./p0076.c) - diff --git a/c/README.rst b/c/README.rst new file mode 100644 index 00000000..62ee274d --- /dev/null +++ b/c/README.rst @@ -0,0 +1,200 @@ +C Section +========= + +.. |C Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml + +|C Check| + +All problems are solved in C11, though most if not all of it is +C99-compatible. It is tested on clang, gcc, pcc, tcc, and msvc (the Visual Studios +compiler). + +Organization +------------ + +All C files share a common prefix with their problem number. All shared +functions are moved to header files in the include subfolder + +Makefile +-------- + +There are four main recipes in this Makefile + +dependencies +~~~~~~~~~~~~ + +This recipe installs all the required and test dependencies. See the +Dependencies section for more info + +test +~~~~ + +This recipe runs tests in a single thread and performs benchmarks on +each. This test infrastructure is recycled from the python section. + +test\_\* +~~~~~~~~ + +This recipe runs tests in multiple threads, using however many are +specified by the number after the \_. For example, ``test_3`` would +spawn three python processes. Because benchmark disables itself when +running in children processes, benchmark info is not available with this +recipe. + +native +~~~~~~ + +This recipe builds a test executable using the Unity test framework. It +recycles no Python infrastructure, but consequently cannot test some +features like compiler macros and deterministic building. + +Tests +----- + +Compiler Detection Macros +~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a set of macros which detect which compiler is being used. +These macros are mostly used to route around issues with particular +compilers. For instance, PCC does not allow me to include ```` +or ```` on the systems I've tested it on, so I need to route +around that. This test checks that those macros are correct. + +Prime Infrastructure Test +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This test checks five things: + +1. It checks ``is_prime()`` for numbers up to ``MAX_PRIME``, where that + is defined in the test +2. It checks that ``is_composite()`` returns truthy values on composites + in that range, and falsey values on primes +3. It checks that ``is_composite()`` returns the smallest prime factor + on composite numbers +4. It checks that the prime numbers are generated in the correct order +5. It checks that all these operations are completed in less than 200ns + \* ``MAX_PRIME`` + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will run it as many times +as the benchmark plugin wants. Otherwise it is run exactly once. + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are no non-test +dependencies for this section. + +Note that there are optional test that leverage the Python +infrastructure. If you want these tests to work you need to go to the +python folder and run ``make dependencies`` or define the +`NO_OPTIONAL_TESTS <#no-slow-tests>`__ environment variable. + +Environment Variables +--------------------- + +COMPILER_OVERRIDE +~~~~~~~~~~~~~~~~~ + +If this variable is defined, it should contain a comma-separated list of +the compilers you would like to test from the following list (case +insensitive): + +- aocc (AMD Optimized C Compiler) +- cl (Visual Studios compiler) +- clang +- gcc +- icc (Intel C Compiler) +- pcc (Portable C Compiler) +- tcc (Tiny C Compiler) + +If this variable is not defined, compilers will be auto-detected using +``which()``. + +AOCC_OVERRIDE +~~~~~~~~~~~~~ + +If this variable is defined, it should hold a string representing the +AMD compiler binary you would like to use. One case you may want this in +is to test both the AMD compiler and traditional clang by renaming the +AMD compiler's executable. + +GCC_OVERRIDE +~~~~~~~~~~~~ + +If this variable is defined, it should hold a string representing the +``gcc`` binary you would like to use. One case you may want this in is +on OSX or Termux, where ``gcc`` is often remapped to ``clang``. + +NO_OPTIONAL_TESTS +~~~~~~~~~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, the test suite will skip any tests which are not directly +related to Project Euler problems. This value will default to the same +value as `ONLY_SLOW <#only-slow>`__. + +NO_SLOW +~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, problems in the known_slow group will not be tested. This +variable defaults to True on Termux systems. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +ONLY_SLOW +~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, *only* problems in the known_slow group will be tested. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.c>`__ + +- ☒ `2 <./p0002.c>`__ + +- ☒ `3 <./p0003.c>`__ + +- ☒ `4 <./p0004.c>`__ + +- ☒ `5 <./p0005.c>`__ + +- ☒ `6 <./p0006.c>`__ + +- ☒ `7 <./p0007.c>`__ + +- ☒ `8 <./p0008.c>`__ + +- ☒ `9 <./p0009.c>`__ + +- ☒ `10 <./p0010.c>`__ + +- ☒ `11 <./p0011.c>`__ + +- ☐ `12 <./p0012.c>`__ + +- ☒ `13 <./p0013.c>`__ + +- ☒ `14 <./p0014.c>`__ + +- ☒ `15 <./p0015.c>`__ + +- ☒ `16 <./p0016.c>`__ + +- ☒ `34 <./p0034.c>`__ + +- ☒ `76 <./p0076.c>`__ diff --git a/csharp/README.md b/csharp/README.md deleted file mode 100644 index 315cac51..00000000 --- a/csharp/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# C# Section - -[![C# Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml) - -All problems are solved in .NET 6, though an effort is made to support other versions. - -## Organization - -All C# files share a common prefix with their problem number. All shared functions are defined in the include folder. - -## Makefile - -There are three main recipes in this Makefile - -### dependencies - -This recipe installs all the required and test dependencies. See the Dependencies section for more info - -### test - -This recipe runs tests in multiple threads - -### lint - -This recipe runs `dotnet`s builtin linter with the `--verify-no-changes` flag - -## Tests - -### Prime Infrastructure Test - -This test checks five things: - -1. It checks `is_prime()` for numbers up to `MAX_PRIME`, where that is defined in the test -2. It checks that `is_composite()` returns truthy values on composites in that range, and falsey values on primes -3. It checks that `is_composite()` returns the smallest prime factor on composite numbers -4. It checks that the prime numbers are generated in the correct order -5. It checks that all these operations are completed in less than 200ns * `MAX_PRIME` - -### Generic Problems - -For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will always be run. Otherwise it tries to detect the `NO_SLOW` environment variable and dynamically skip them. - -A test fails if it gets the wrong answer or if it takes more than 1 minute. - -## Dependencies - -I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. - -## Problems Solved - -- [x] [1](./p0001.cs) diff --git a/csharp/README.rst b/csharp/README.rst new file mode 100644 index 00000000..65816dd0 --- /dev/null +++ b/csharp/README.rst @@ -0,0 +1,80 @@ +C# Section +========== + +.. |C# Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml + +|C# Check| + +All problems are solved in .NET 6, though an effort is made to support +other versions. + +Organization +------------ + +All C# files share a common prefix with their problem number. All shared +functions are defined in the include folder. + +Makefile +-------- + +There are three main recipes in this Makefile + +dependencies +~~~~~~~~~~~~ + +This recipe installs all the required and test dependencies. See the +Dependencies section for more info + +test +~~~~ + +This recipe runs tests in multiple threads + +lint +~~~~ + +This recipe runs ``dotnet``\ s builtin linter with the +``--verify-no-changes`` flag + +Tests +----- + +Prime Infrastructure Test +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This test checks five things: + +1. It checks ``is_prime()`` for numbers up to ``MAX_PRIME``, where that + is defined in the test +2. It checks that ``is_composite()`` returns truthy values on composites + in that range, and falsey values on primes +3. It checks that ``is_composite()`` returns the smallest prime factor + on composite numbers +4. It checks that the prime numbers are generated in the correct order +5. It checks that all these operations are completed in less than 200ns + \* ``MAX_PRIME`` + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will always be run. +Otherwise it tries to detect the ``NO_SLOW`` environment variable and +dynamically skip them. + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are no non-test +dependencies for this section. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.cs>`__ diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..aa8967e6 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,36 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= -j auto +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build +PY?=python3 +USER_FLAG?=--user +PIP?=$(PY) -m pip +ifneq ($(https_proxy), ) +PROXY_ARG=--proxy=$(https_proxy) +else +ifneq ($(http_proxy), ) +PROXY_ARG=--proxy=$(http_proxy) +else +PROXY_ARG= +endif +endif + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +dependencies: + $(PIP) install -r requirements.txt $(USER_FLAG) $(PROXY_ARG) + cd ../python && $(MAKE) dependencies $(MFLAGS) + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile dependencies + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/c.rst b/docs/c.rst new file mode 100644 index 00000000..b0866e1b --- /dev/null +++ b/docs/c.rst @@ -0,0 +1,12 @@ +Euler C Implementation +====================== + +.. include:: ../c/README.rst + :start-line: 2 + :end-before: Problems Solved + +Problems Solved +~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..23f7fef6 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,54 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +import os +import sys +basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +sys.path.insert(0, basedir) +sys.path.insert(0, basedir + os.sep + 'python') + +project = 'Euler' +copyright = '2024, Olivia Appleton' +author = 'Olivia Appleton' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosectionlabel', + 'sphinx.ext.githubpages', + 'sphinx.ext.graphviz', + 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.mathjax', + 'sphinx.ext.todo', + # 'sphinx-c-autodoc', + # 'breathe', + # 'javasphinx', + # 'sphinx-autodoc-typehints', + # 'sphinx-git', + # 'sphinx-pyreverse', + # 'sphinxcontrib-autojs', + # 'sphinx-csharp', +] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +language = 'english' + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'agogo' +html_static_path = ['_static'] + +# -- Options for todo extension ---------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration + +todo_include_todos = True diff --git a/docs/csharp.rst b/docs/csharp.rst new file mode 100644 index 00000000..28245eb9 --- /dev/null +++ b/docs/csharp.rst @@ -0,0 +1,12 @@ +Euler C# Implementation +======================= + +.. include:: ../csharp/README.rst + :start-line: 2 + :end-before: Problems Solved + +Problems Solved +~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..4dc556f4 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,29 @@ +.. Euler documentation master file, created by + sphinx-quickstart on Fri Jun 28 11:07:39 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Euler's documentation! +================================= + +.. toctree:: + :maxdepth: 1 + + usage + c + csharp + javascript + python + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. Recent Changes +.. ============== + +.. .. git_changelog:: +.. :revisions: 16 \ No newline at end of file diff --git a/docs/javascript.rst b/docs/javascript.rst new file mode 100644 index 00000000..d1bc4f94 --- /dev/null +++ b/docs/javascript.rst @@ -0,0 +1,12 @@ +Euler JavaScript Implementation +=============================== + +.. include:: ../javascript/README.rst + :start-line: 2 + :end-before: Problems Solved + +Problems Solved +~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 diff --git a/docs/python.rst b/docs/python.rst new file mode 100644 index 00000000..5fc3ef15 --- /dev/null +++ b/docs/python.rst @@ -0,0 +1,83 @@ +Euler Python Implementation +=========================== + +.. include:: ../python/README.rst + :start-line: 2 + :end-before: Problems Solved + +Problems Solved +~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 + + python/p0001.rst + python/p0002.rst + python/p0003.rst + python/p0004.rst + python/p0005.rst + python/p0006.rst + python/p0007.rst + python/p0008.rst + python/p0009.rst + python/p0010.rst + python/p0011.rst + python/p0012.rst + python/p0013.rst + python/p0014.rst + python/p0015.rst + python/p0016.rst + python/p0017.rst + python/p0018.rst + python/p0019.rst + python/p0020.rst + python/p0021.rst + python/p0022.rst + python/p0023.rst + python/p0024.rst + python/p0025.rst + python/p0027.rst + python/p0029.rst + python/p0030.rst + python/p0031.rst + python/p0032.rst + python/p0033.rst + python/p0034.rst + python/p0035.rst + python/p0036.rst + python/p0037.rst + python/p0038.rst + python/p0039.rst + python/p0040.rst + python/p0041.rst + python/p0042.rst + python/p0043.rst + python/p0044.rst + python/p0045.rst + python/p0046.rst + python/p0047.rst + python/p0048.rst + python/p0049.rst + python/p0050.rst + python/p0052.rst + python/p0053.rst + python/p0055.rst + python/p0056.rst + python/p0057.rst + python/p0059.rst + python/p0067.rst + python/p0069.rst + python/p0071.rst + python/p0073.rst + python/p0074.rst + python/p0076.rst + python/p0077.rst + python/p0087.rst + python/p0092.rst + python/p0097.rst + python/p0118.rst + python/p0123.rst + python/p0134.rst + python/p0145.rst + python/p0187.rst + python/p0206.rst diff --git a/docs/python/p0001.rst b/docs/python/p0001.rst new file mode 100644 index 00000000..70bb251b --- /dev/null +++ b/docs/python/p0001.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 1 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0001 + :members: + :undoc-members: diff --git a/docs/python/p0002.rst b/docs/python/p0002.rst new file mode 100644 index 00000000..1acbf695 --- /dev/null +++ b/docs/python/p0002.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 2 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0002 + :members: + :undoc-members: diff --git a/docs/python/p0003.rst b/docs/python/p0003.rst new file mode 100644 index 00000000..abbdd996 --- /dev/null +++ b/docs/python/p0003.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 3 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0003 + :members: + :undoc-members: diff --git a/docs/python/p0004.rst b/docs/python/p0004.rst new file mode 100644 index 00000000..5d797346 --- /dev/null +++ b/docs/python/p0004.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 4 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0004 + :members: + :undoc-members: diff --git a/docs/python/p0005.rst b/docs/python/p0005.rst new file mode 100644 index 00000000..fbe73c9f --- /dev/null +++ b/docs/python/p0005.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 5 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0005 + :members: + :undoc-members: diff --git a/docs/python/p0006.rst b/docs/python/p0006.rst new file mode 100644 index 00000000..5efca0e8 --- /dev/null +++ b/docs/python/p0006.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 6 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0006 + :members: + :undoc-members: diff --git a/docs/python/p0007.rst b/docs/python/p0007.rst new file mode 100644 index 00000000..752a7060 --- /dev/null +++ b/docs/python/p0007.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 7 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0007 + :members: + :undoc-members: diff --git a/docs/python/p0008.rst b/docs/python/p0008.rst new file mode 100644 index 00000000..a483f270 --- /dev/null +++ b/docs/python/p0008.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 8 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0008 + :members: + :undoc-members: diff --git a/docs/python/p0009.rst b/docs/python/p0009.rst new file mode 100644 index 00000000..6dbcbed1 --- /dev/null +++ b/docs/python/p0009.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 9 +================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0009 + :members: + :undoc-members: diff --git a/docs/python/p0010.rst b/docs/python/p0010.rst new file mode 100644 index 00000000..5877fc7a --- /dev/null +++ b/docs/python/p0010.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 10 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0010 + :members: + :undoc-members: diff --git a/docs/python/p0011.rst b/docs/python/p0011.rst new file mode 100644 index 00000000..b4c84779 --- /dev/null +++ b/docs/python/p0011.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 11 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0011 + :members: + :undoc-members: diff --git a/docs/python/p0012.rst b/docs/python/p0012.rst new file mode 100644 index 00000000..59dcfd4b --- /dev/null +++ b/docs/python/p0012.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 12 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0012 + :members: + :undoc-members: diff --git a/docs/python/p0013.rst b/docs/python/p0013.rst new file mode 100644 index 00000000..b0541505 --- /dev/null +++ b/docs/python/p0013.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 13 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0013 + :members: + :undoc-members: diff --git a/docs/python/p0014.rst b/docs/python/p0014.rst new file mode 100644 index 00000000..e098ba52 --- /dev/null +++ b/docs/python/p0014.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 14 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0014 + :members: + :undoc-members: diff --git a/docs/python/p0015.rst b/docs/python/p0015.rst new file mode 100644 index 00000000..7f0ecf77 --- /dev/null +++ b/docs/python/p0015.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 15 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0015 + :members: + :undoc-members: diff --git a/docs/python/p0016.rst b/docs/python/p0016.rst new file mode 100644 index 00000000..45d3a571 --- /dev/null +++ b/docs/python/p0016.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 16 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0016 + :members: + :undoc-members: diff --git a/docs/python/p0017.rst b/docs/python/p0017.rst new file mode 100644 index 00000000..dad7178b --- /dev/null +++ b/docs/python/p0017.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 17 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0017 + :members: + :undoc-members: diff --git a/docs/python/p0018.rst b/docs/python/p0018.rst new file mode 100644 index 00000000..c293f33e --- /dev/null +++ b/docs/python/p0018.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 18 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0018 + :members: + :undoc-members: diff --git a/docs/python/p0019.rst b/docs/python/p0019.rst new file mode 100644 index 00000000..1f8a4d56 --- /dev/null +++ b/docs/python/p0019.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 19 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0019 + :members: + :undoc-members: diff --git a/docs/python/p0020.rst b/docs/python/p0020.rst new file mode 100644 index 00000000..34c3dcbb --- /dev/null +++ b/docs/python/p0020.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 20 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0020 + :members: + :undoc-members: diff --git a/docs/python/p0021.rst b/docs/python/p0021.rst new file mode 100644 index 00000000..25da87af --- /dev/null +++ b/docs/python/p0021.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 21 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0021 + :members: + :undoc-members: diff --git a/docs/python/p0022.rst b/docs/python/p0022.rst new file mode 100644 index 00000000..acecc01c --- /dev/null +++ b/docs/python/p0022.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 22 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0022 + :members: + :undoc-members: diff --git a/docs/python/p0023.rst b/docs/python/p0023.rst new file mode 100644 index 00000000..b9286e7b --- /dev/null +++ b/docs/python/p0023.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 23 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0023 + :members: + :undoc-members: diff --git a/docs/python/p0024.rst b/docs/python/p0024.rst new file mode 100644 index 00000000..526cd6ca --- /dev/null +++ b/docs/python/p0024.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 24 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0024 + :members: + :undoc-members: diff --git a/docs/python/p0025.rst b/docs/python/p0025.rst new file mode 100644 index 00000000..62c719b9 --- /dev/null +++ b/docs/python/p0025.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 25 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0025 + :members: + :undoc-members: diff --git a/docs/python/p0027.rst b/docs/python/p0027.rst new file mode 100644 index 00000000..d49a068e --- /dev/null +++ b/docs/python/p0027.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 27 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0027 + :members: + :undoc-members: diff --git a/docs/python/p0029.rst b/docs/python/p0029.rst new file mode 100644 index 00000000..c0a4b000 --- /dev/null +++ b/docs/python/p0029.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 29 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0029 + :members: + :undoc-members: diff --git a/docs/python/p0030.rst b/docs/python/p0030.rst new file mode 100644 index 00000000..03699e85 --- /dev/null +++ b/docs/python/p0030.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 30 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0030 + :members: + :undoc-members: diff --git a/docs/python/p0031.rst b/docs/python/p0031.rst new file mode 100644 index 00000000..026ea494 --- /dev/null +++ b/docs/python/p0031.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 31 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0031 + :members: + :undoc-members: diff --git a/docs/python/p0032.rst b/docs/python/p0032.rst new file mode 100644 index 00000000..4da4846f --- /dev/null +++ b/docs/python/p0032.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 32 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0032 + :members: + :undoc-members: diff --git a/docs/python/p0033.rst b/docs/python/p0033.rst new file mode 100644 index 00000000..6c029781 --- /dev/null +++ b/docs/python/p0033.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 33 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0033 + :members: + :undoc-members: diff --git a/docs/python/p0034.rst b/docs/python/p0034.rst new file mode 100644 index 00000000..10573269 --- /dev/null +++ b/docs/python/p0034.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 34 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0034 + :members: + :undoc-members: diff --git a/docs/python/p0035.rst b/docs/python/p0035.rst new file mode 100644 index 00000000..2f79bf71 --- /dev/null +++ b/docs/python/p0035.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 35 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0035 + :members: + :undoc-members: diff --git a/docs/python/p0036.rst b/docs/python/p0036.rst new file mode 100644 index 00000000..ff66616f --- /dev/null +++ b/docs/python/p0036.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 36 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0036 + :members: + :undoc-members: diff --git a/docs/python/p0037.rst b/docs/python/p0037.rst new file mode 100644 index 00000000..9b42fee7 --- /dev/null +++ b/docs/python/p0037.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 37 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0037 + :members: + :undoc-members: diff --git a/docs/python/p0038.rst b/docs/python/p0038.rst new file mode 100644 index 00000000..9288af14 --- /dev/null +++ b/docs/python/p0038.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 38 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0038 + :members: + :undoc-members: diff --git a/docs/python/p0039.rst b/docs/python/p0039.rst new file mode 100644 index 00000000..57bc78e3 --- /dev/null +++ b/docs/python/p0039.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 39 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0039 + :members: + :undoc-members: diff --git a/docs/python/p0040.rst b/docs/python/p0040.rst new file mode 100644 index 00000000..f1f2885d --- /dev/null +++ b/docs/python/p0040.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 40 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0040 + :members: + :undoc-members: diff --git a/docs/python/p0041.rst b/docs/python/p0041.rst new file mode 100644 index 00000000..4cd7957a --- /dev/null +++ b/docs/python/p0041.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 41 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0041 + :members: + :undoc-members: diff --git a/docs/python/p0042.rst b/docs/python/p0042.rst new file mode 100644 index 00000000..c536b987 --- /dev/null +++ b/docs/python/p0042.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 42 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0042 + :members: + :undoc-members: diff --git a/docs/python/p0043.rst b/docs/python/p0043.rst new file mode 100644 index 00000000..5f27f579 --- /dev/null +++ b/docs/python/p0043.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 43 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0043 + :members: + :undoc-members: diff --git a/docs/python/p0044.rst b/docs/python/p0044.rst new file mode 100644 index 00000000..05e3b60b --- /dev/null +++ b/docs/python/p0044.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 44 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0044 + :members: + :undoc-members: diff --git a/docs/python/p0045.rst b/docs/python/p0045.rst new file mode 100644 index 00000000..68a436ac --- /dev/null +++ b/docs/python/p0045.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 45 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0045 + :members: + :undoc-members: diff --git a/docs/python/p0046.rst b/docs/python/p0046.rst new file mode 100644 index 00000000..f49611f3 --- /dev/null +++ b/docs/python/p0046.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 46 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0046 + :members: + :undoc-members: diff --git a/docs/python/p0047.rst b/docs/python/p0047.rst new file mode 100644 index 00000000..4dc9c991 --- /dev/null +++ b/docs/python/p0047.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 47 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0047 + :members: + :undoc-members: diff --git a/docs/python/p0048.rst b/docs/python/p0048.rst new file mode 100644 index 00000000..fc0c8da9 --- /dev/null +++ b/docs/python/p0048.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 48 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0048 + :members: + :undoc-members: diff --git a/docs/python/p0049.rst b/docs/python/p0049.rst new file mode 100644 index 00000000..dff16d6c --- /dev/null +++ b/docs/python/p0049.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 49 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0049 + :members: + :undoc-members: diff --git a/docs/python/p0050.rst b/docs/python/p0050.rst new file mode 100644 index 00000000..826a353a --- /dev/null +++ b/docs/python/p0050.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 50 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0050 + :members: + :undoc-members: diff --git a/docs/python/p0052.rst b/docs/python/p0052.rst new file mode 100644 index 00000000..4a0a8754 --- /dev/null +++ b/docs/python/p0052.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 52 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0052 + :members: + :undoc-members: diff --git a/docs/python/p0053.rst b/docs/python/p0053.rst new file mode 100644 index 00000000..23fab2f6 --- /dev/null +++ b/docs/python/p0053.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 53 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0053 + :members: + :undoc-members: diff --git a/docs/python/p0055.rst b/docs/python/p0055.rst new file mode 100644 index 00000000..f7f49dec --- /dev/null +++ b/docs/python/p0055.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 55 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0055 + :members: + :undoc-members: diff --git a/docs/python/p0056.rst b/docs/python/p0056.rst new file mode 100644 index 00000000..a81d13af --- /dev/null +++ b/docs/python/p0056.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 56 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0056 + :members: + :undoc-members: diff --git a/docs/python/p0057.rst b/docs/python/p0057.rst new file mode 100644 index 00000000..a180065a --- /dev/null +++ b/docs/python/p0057.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 57 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0057 + :members: + :undoc-members: diff --git a/docs/python/p0059.rst b/docs/python/p0059.rst new file mode 100644 index 00000000..4422bed2 --- /dev/null +++ b/docs/python/p0059.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 59 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0059 + :members: + :undoc-members: diff --git a/docs/python/p0067.rst b/docs/python/p0067.rst new file mode 100644 index 00000000..0612a148 --- /dev/null +++ b/docs/python/p0067.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 67 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0067 + :members: + :undoc-members: diff --git a/docs/python/p0069.rst b/docs/python/p0069.rst new file mode 100644 index 00000000..2c82087b --- /dev/null +++ b/docs/python/p0069.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 69 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0069 + :members: + :undoc-members: diff --git a/docs/python/p0071.rst b/docs/python/p0071.rst new file mode 100644 index 00000000..b1dd70d8 --- /dev/null +++ b/docs/python/p0071.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 71 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0071 + :members: + :undoc-members: diff --git a/docs/python/p0073.rst b/docs/python/p0073.rst new file mode 100644 index 00000000..d4c0a42e --- /dev/null +++ b/docs/python/p0073.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 73 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0073 + :members: + :undoc-members: diff --git a/docs/python/p0074.rst b/docs/python/p0074.rst new file mode 100644 index 00000000..95df6944 --- /dev/null +++ b/docs/python/p0074.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 74 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0074 + :members: + :undoc-members: diff --git a/docs/python/p0076.rst b/docs/python/p0076.rst new file mode 100644 index 00000000..2a2825cf --- /dev/null +++ b/docs/python/p0076.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 76 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0076 + :members: + :undoc-members: diff --git a/docs/python/p0077.rst b/docs/python/p0077.rst new file mode 100644 index 00000000..d4d29151 --- /dev/null +++ b/docs/python/p0077.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 77 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0077 + :members: + :undoc-members: diff --git a/docs/python/p0087.rst b/docs/python/p0087.rst new file mode 100644 index 00000000..99641733 --- /dev/null +++ b/docs/python/p0087.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 87 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0087 + :members: + :undoc-members: diff --git a/docs/python/p0092.rst b/docs/python/p0092.rst new file mode 100644 index 00000000..6ecdf698 --- /dev/null +++ b/docs/python/p0092.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 92 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0092 + :members: + :undoc-members: diff --git a/docs/python/p0097.rst b/docs/python/p0097.rst new file mode 100644 index 00000000..31a3ccdb --- /dev/null +++ b/docs/python/p0097.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 97 +=================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0097 + :members: + :undoc-members: diff --git a/docs/python/p0118.rst b/docs/python/p0118.rst new file mode 100644 index 00000000..a1f848ea --- /dev/null +++ b/docs/python/p0118.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 118 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0118 + :members: + :undoc-members: diff --git a/docs/python/p0123.rst b/docs/python/p0123.rst new file mode 100644 index 00000000..18ff13af --- /dev/null +++ b/docs/python/p0123.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 123 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0123 + :members: + :undoc-members: diff --git a/docs/python/p0134.rst b/docs/python/p0134.rst new file mode 100644 index 00000000..41bb705b --- /dev/null +++ b/docs/python/p0134.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 134 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0134 + :members: + :undoc-members: diff --git a/docs/python/p0145.rst b/docs/python/p0145.rst new file mode 100644 index 00000000..d67e7d0b --- /dev/null +++ b/docs/python/p0145.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 145 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0145 + :members: + :undoc-members: diff --git a/docs/python/p0187.rst b/docs/python/p0187.rst new file mode 100644 index 00000000..74bfae29 --- /dev/null +++ b/docs/python/p0187.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 187 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0187 + :members: + :undoc-members: diff --git a/docs/python/p0206.rst b/docs/python/p0206.rst new file mode 100644 index 00000000..1fabbdef --- /dev/null +++ b/docs/python/p0206.rst @@ -0,0 +1,8 @@ +Python Implementation of Problem 206 +==================================== + +View source code `here on GitHub! `_ + +.. automodule:: python.p0206 + :members: + :undoc-members: diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..93e1cf43 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +sphinx +sphinx-rtd-theme +sphinx-git \ No newline at end of file diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 00000000..627840fb --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,11 @@ +Euler Usage +=========== + +This repo includes solutions in the following languages: + +.. include:: ../README.rst + :start-line: 2 + :end-before: This is the repository + +.. include:: ../README.rst + :start-after: If you are working on Project Euler problems, DO NOT use this as a source \ No newline at end of file diff --git a/javascript/README.md b/javascript/README.md deleted file mode 100644 index 223e01c6..00000000 --- a/javascript/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# JavaScript Section - -[![JavaScript Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml) - -All problems are solved in ES6+ Javascript - -## Organization - -All javascript files share a common prefix with their problem number. Though it is currently not the case, some of these files may export utilities for other problems to use. - -## Makefile - -There are two main recipes in this Makefile - -### dependencies - -This recipe installs all the required and test dependencies. See the Dependencies section for more info - -### test - -This recipe runs tests in a single thread and performs benchmarks on each. This test infrastructure is based on mocha and benchmark.js, though it currently does not export benchmark info except to fail tests for time limit reasons. - -## Tests - -### Generic Problems - -For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will run it as many times as the benchmark plugin wants. Otherwise it is run exactly once\*. - -\* This is a TODO for the Javascript section - -A test fails if it gets the wrong answer or if it takes more than 1 minute. - -## Dependencies - -I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are no non-test dependencies for this section. - -## Problems Solved - -- [x] [1](./p0001.js) -- [x] [2](./p0002.js) diff --git a/javascript/README.rst b/javascript/README.rst new file mode 100644 index 00000000..50d2dead --- /dev/null +++ b/javascript/README.rst @@ -0,0 +1,64 @@ +JavaScript Section +================== + +.. |JavaScript Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml + +|JavaScript Check| + +All problems are solved in ES6+ Javascript + +Organization +------------ + +All javascript files share a common prefix with their problem number. +Though it is currently not the case, some of these files may export +utilities for other problems to use. + +Makefile +-------- + +There are two main recipes in this Makefile + +dependencies +~~~~~~~~~~~~ + +This recipe installs all the required and test dependencies. See the +Dependencies section for more info + +test +~~~~ + +This recipe runs tests in a single thread and performs benchmarks on +each. This test infrastructure is based on mocha and benchmark.js, +though it currently does not export benchmark info except to fail tests +for time limit reasons. + +Tests +----- + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will run it as many times +as the benchmark plugin wants. Otherwise it is run exactly once*. + +\* This is a TODO for the Javascript section + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are no non-test +dependencies for this section. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.js>`__ +- ☒ `2 <./p0002.js>`__ diff --git a/python/README.md b/python/README.md deleted file mode 100644 index 8c617c01..00000000 --- a/python/README.md +++ /dev/null @@ -1,153 +0,0 @@ -# Python Section - -[![Python Check](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg)](https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml) - -All problems are solved in type-hinted python3 - -## Organization - -All files share a common prefix with their problem number. Several of the problems also have code leveraged as if they were a library. That list is (approximately): - -* p0002 for the fibonacci sequence -* p0003 for prime numbers and factors -* p0004 for palindrome detection -* p0007 for is_prime() -* p0008 for iterating over a series in groups of n -* p0015 for n_choose_r -* p0018 for trianglar pathfinding - * only used by p0018 and p0067 -* p0021 for proper divisors -* p0052 and p0074 for digits functions - * p0052 for a sequence - * p0074 for a generator -* p0055 for retrieving a number from its digits - -## Makefile - -There are three main recipes in this Makefile - -### dependencies - -This recipe installs all the required and test dependencies. See the Dependencies section for more info - -### test - -This recipe runs tests in a single thread and performs benchmarks and style checks on them. - -### test_* - -This recipe runs tests in multiple threads, using however many are specified by the number after the _. For example, `test_3` would spawn three python processes. Because benchmark disables itself when running in children processes, benchmark info is not available with this recipe. - -## Tests - -### Prime Numbers - -There is a single test for the prime number infrastructure. It has three components: - -1. It checks that it correctly generates the first million primes in the correct order -2. It checks that is_prime() operates correctly for all numbers in that range, including all composites between them -3. It checks that the whole series takes <200ns/prime to compute - -### Generic Problems - -For each problem it will check the answer against a known dictionary. If the problem is not in the "known slow" category (meaning that I generate the correct answer with a poor solution), it will run it as many times as the benchmark plugin wants. Otherwise it is run exactly once. - -A test fails if it gets the wrong answer or if it takes more than 1 minute. - -## Dependencies - -I try to keep the dependencies of this project as small as possible, except for test plugins. At the moment there are only two non-test dependencies: - -### u-msgpack-python - -This serialization library encodes things in the MessagePack format. The reason it is not only for testing is that it allows me to read from a cache of prime numbers stored on disk. This is not required, and if you remove it (and the import) things would still run correctly. - -### sortedcontainers - -This library provides a collection of sorted containers. At the time of writing this, the only one I use is SortedSet() for the prime number generator. If I were willing to remove the prime number cache this would not be needed. I could also implement my own if need be. - -## Environment Variables - -### NO_OPTIONAL_TESTS - -If this variable is defined to something other than 0 or an empty string, the test suite will skip any tests which are not directly related to Project Euler problems. This value will default to the same value as [`ONLY_SLOW`](#only-slow). - -### NO_SLOW - -If this variable is defined to something other than 0 or an empty string, problems in the known_slow group will not be tested. This variable defaults to True on Termux systems. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. - -### ONLY_SLOW - -If this variable is defined to something other than 0 or an empty string, *only* problems in the known_slow group will be tested. If both [`NO_SLOW`](#no-slow) and [`ONLY_SLOW`](#only-slow) are truthy, they will be ignored and a warning will be issued. -## Problems Solved - -- [x] [1](./p0001.py) -- [x] [2](./p0002.py) -- [x] [3](./p0003.py) -- [x] [4](./p0004.py) -- [x] [5](./p0005.py) -- [x] [6](./p0006.py) -- [x] [7](./p0007.py) -- [x] [8](./p0008.py) -- [x] [9](./p0009.py) -- [x] [10](./p0010.py) -- [x] [11](./p0011.py) -- [x] [12](./p0012.py) -- [x] [13](./p0013.py) -- [x] [14](./p0014.py) -- [x] [15](./p0015.py) -- [x] [16](./p0016.py) -- [x] [17](./p0017.py) -- [x] [18](./p0018.py) -- [x] [19](./p0019.py) -- [x] [20](./p0020.py) -- [x] [21](./p0021.py) -- [x] [22](./p0022.py) -- [x] [23](./p0023.py) -- [x] [24](./p0024.py) -- [x] [25](./p0025.py) -- [x] [27](./p0027.py) -- [x] [29](./p0029.py) -- [x] [30](./p0030.py) -- [x] [31](./p0031.py) -- [x] [32](./p0032.py) -- [x] [33](./p0033.py) -- [x] [34](./p0034.py) -- [x] [35](./p0035.py) -- [x] [36](./p0036.py) -- [x] [37](./p0037.py) -- [x] [38](./p0038.py) -- [x] [39](./p0039.py) -- [x] [40](./p0040.py) -- [x] [41](./p0041.py) -- [x] [42](./p0042.py) -- [x] [43](./p0043.py) -- [x] [44](./p0044.py) -- [x] [45](./p0045.py) -- [x] [46](./p0046.py) -- [x] [47](./p0047.py) -- [x] [48](./p0048.py) -- [x] [49](./p0049.py) -- [x] [50](./p0050.py) -- [x] [52](./p0052.py) -- [x] [53](./p0053.py) -- [x] [55](./p0055.py) -- [x] [56](./p0056.py) -- [x] [57](./p0057.py) -- [x] [59](./p0059.py) -- [x] [67](./p0067.py) -- [x] [69](./p0069.py) -- [x] [71](./p0071.py) -- [x] [73](./p0073.py) -- [x] [74](./p0074.py) -- [x] [76](./p0076.py) -- [x] [77](./p0077.py) -- [x] [87](./p0087.py) -- [x] [92](./p0092.py) -- [x] [98](./p0098.py) -- [x] [118](./p0118.py) -- [x] [123](./p0123.py) -- [x] [134](./p0134.py) -- [x] [145](./p0145.py) -- [x] [187](./p0187.py) -- [x] [206](./p0206.py) diff --git a/python/README.rst b/python/README.rst new file mode 100644 index 00000000..cdd787d1 --- /dev/null +++ b/python/README.rst @@ -0,0 +1,209 @@ +Python Section +============== + +.. |Python Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml + +|Python Check| + +All problems are solved in type-hinted python3 + +Organization +------------ + +All files share a common prefix with their problem number. Several of +the problems also have code leveraged as if they were a library. That +list is (approximately): + +- p0002 for the fibonacci sequence +- p0003 for prime numbers and factors +- p0004 for palindrome detection +- p0007 for is_prime() +- p0008 for iterating over a series in groups of n +- p0015 for n_choose_r +- p0018 for trianglar pathfinding + + - only used by p0018 and p0067 +- p0021 for proper divisors +- p0052 and p0074 for digits functions + + - p0052 for a sequence + - p0074 for a generator +- p0055 for retrieving a number from its digits + +Makefile +-------- + +There are three main recipes in this Makefile + +dependencies +~~~~~~~~~~~~ + +This recipe installs all the required and test dependencies. See the +Dependencies section for more info + +test +~~~~ + +This recipe runs tests in a single thread and performs benchmarks and +style checks on them. + +test\_\* +~~~~~~~~ + +This recipe runs tests in multiple threads, using however many are +specified by the number after the \_. For example, ``test_3`` would +spawn three python processes. Because benchmark disables itself when +running in children processes, benchmark info is not available with this +recipe. + +Tests +----- + +Prime Numbers +~~~~~~~~~~~~~ + +There is a single test for the prime number infrastructure. It has three +components: + +1. It checks that it correctly generates the first million primes in the + correct order +2. It checks that is_prime() operates correctly for all numbers in that + range, including all composites between them +3. It checks that the whole series takes <200ns/prime to compute + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will run it as many times +as the benchmark plugin wants. Otherwise it is run exactly once. + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are only two non-test +dependencies: + +u-msgpack-python +~~~~~~~~~~~~~~~~ + +This serialization library encodes things in the MessagePack format. The +reason it is not only for testing is that it allows me to read from a +cache of prime numbers stored on disk. This is not required, and if you +remove it (and the import) things would still run correctly. + +sortedcontainers +~~~~~~~~~~~~~~~~ + +This library provides a collection of sorted containers. At the time of +writing this, the only one I use is SortedSet() for the prime number +generator. If I were willing to remove the prime number cache this would +not be needed. I could also implement my own if need be. + +Environment Variables +--------------------- + +NO_OPTIONAL_TESTS +~~~~~~~~~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, the test suite will skip any tests which are not directly +related to Project Euler problems. This value will default to the same +value as `ONLY_SLOW <#only-slow>`__. + +NO_SLOW +~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, problems in the known_slow group will not be tested. This +variable defaults to True on Termux systems. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +ONLY_SLOW +~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, *only* problems in the known_slow group will be tested. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.py>`__ +- ☒ `2 <./p0002.py>`__ +- ☒ `3 <./p0003.py>`__ +- ☒ `4 <./p0004.py>`__ +- ☒ `5 <./p0005.py>`__ +- ☒ `6 <./p0006.py>`__ +- ☒ `7 <./p0007.py>`__ +- ☒ `8 <./p0008.py>`__ +- ☒ `9 <./p0009.py>`__ +- ☒ `10 <./p0010.py>`__ +- ☒ `11 <./p0011.py>`__ +- ☒ `12 <./p0012.py>`__ +- ☒ `13 <./p0013.py>`__ +- ☒ `14 <./p0014.py>`__ +- ☒ `15 <./p0015.py>`__ +- ☒ `16 <./p0016.py>`__ +- ☒ `17 <./p0017.py>`__ +- ☒ `18 <./p0018.py>`__ +- ☒ `19 <./p0019.py>`__ +- ☒ `20 <./p0020.py>`__ +- ☒ `21 <./p0021.py>`__ +- ☒ `22 <./p0022.py>`__ +- ☒ `23 <./p0023.py>`__ +- ☒ `24 <./p0024.py>`__ +- ☒ `25 <./p0025.py>`__ +- ☒ `27 <./p0027.py>`__ +- ☒ `29 <./p0029.py>`__ +- ☒ `30 <./p0030.py>`__ +- ☒ `31 <./p0031.py>`__ +- ☒ `32 <./p0032.py>`__ +- ☒ `33 <./p0033.py>`__ +- ☒ `34 <./p0034.py>`__ +- ☒ `35 <./p0035.py>`__ +- ☒ `36 <./p0036.py>`__ +- ☒ `37 <./p0037.py>`__ +- ☒ `38 <./p0038.py>`__ +- ☒ `39 <./p0039.py>`__ +- ☒ `40 <./p0040.py>`__ +- ☒ `41 <./p0041.py>`__ +- ☒ `42 <./p0042.py>`__ +- ☒ `43 <./p0043.py>`__ +- ☒ `44 <./p0044.py>`__ +- ☒ `45 <./p0045.py>`__ +- ☒ `46 <./p0046.py>`__ +- ☒ `47 <./p0047.py>`__ +- ☒ `48 <./p0048.py>`__ +- ☒ `49 <./p0049.py>`__ +- ☒ `50 <./p0050.py>`__ +- ☒ `52 <./p0052.py>`__ +- ☒ `53 <./p0053.py>`__ +- ☒ `55 <./p0055.py>`__ +- ☒ `56 <./p0056.py>`__ +- ☒ `57 <./p0057.py>`__ +- ☒ `59 <./p0059.py>`__ +- ☒ `67 <./p0067.py>`__ +- ☒ `69 <./p0069.py>`__ +- ☒ `71 <./p0071.py>`__ +- ☒ `73 <./p0073.py>`__ +- ☒ `74 <./p0074.py>`__ +- ☒ `76 <./p0076.py>`__ +- ☒ `77 <./p0077.py>`__ +- ☒ `87 <./p0087.py>`__ +- ☒ `92 <./p0092.py>`__ +- ☒ `98 <./p0098.py>`__ +- ☒ `118 <./p0118.py>`__ +- ☒ `123 <./p0123.py>`__ +- ☒ `134 <./p0134.py>`__ +- ☒ `145 <./p0145.py>`__ +- ☒ `187 <./p0187.py>`__ +- ☒ `206 <./p0206.py>`__ diff --git a/python/p0012.py b/python/p0012.py index 0e2b61a7..41cd893f 100644 --- a/python/p0012.py +++ b/python/p0012.py @@ -14,6 +14,8 @@ Let us list the factors of the first seven triangle numbers: +.. code-block:: + 1: 1 3: 1,3 6: 1,2,3,6 diff --git a/python/p0018.py b/python/p0018.py index d8b5be1f..8b4431b2 100644 --- a/python/p0018.py +++ b/python/p0018.py @@ -8,30 +8,34 @@ By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. - 3 - 7 4 - 2 4 6 -8 5 9 3 +.. code-block:: + + 3 + 7 4 + 2 4 6 + 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: - 75 - 95 64 - 17 47 82 - 18 35 87 10 - 20 04 82 47 65 - 19 01 23 75 03 34 - 88 02 77 73 07 63 67 - 99 65 04 28 06 16 70 92 - 41 41 26 56 83 40 80 70 33 - 41 48 72 33 47 32 37 16 94 29 - 53 71 44 65 25 43 91 52 97 51 14 - 70 11 33 28 77 73 17 78 39 68 17 57 - 91 71 52 38 17 14 91 43 58 50 27 29 48 - 63 66 04 68 89 53 67 30 73 16 69 87 40 31 -04 62 98 27 23 09 70 98 73 93 38 53 60 04 23 +.. code-block:: + + 75 + 95 64 + 17 47 82 + 18 35 87 10 + 20 04 82 47 65 + 19 01 23 75 03 34 + 88 02 77 73 07 63 67 + 99 65 04 28 06 16 70 92 + 41 41 26 56 83 40 80 70 33 + 41 48 72 33 47 32 37 16 94 29 + 53 71 44 65 25 43 91 52 97 51 14 + 70 11 33 28 77 73 17 78 39 68 17 57 + 91 71 52 38 17 14 91 43 58 50 27 29 48 + 63 66 04 68 89 53 67 30 73 16 69 87 40 31 + 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23 NOTE: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a diff --git a/python/p0027.py b/python/p0027.py index 8a08e256..03cd4438 100644 --- a/python/p0027.py +++ b/python/p0027.py @@ -8,10 +8,10 @@ n**2+n+41 It turns out that the formula will produce 40 primes for the consecutive -integer values 0≤n≤39. However, when n=40,40**2+40+41=40(40+1)+41 is divisible -by 41, and certainly when n=41,41**2+41+41 is clearly divisible by 41. +integer values 0≤n≤39. However, when ``n=40``, ``40**2+40+41=40(40+1)+41`` is divisible +by 41, and certainly when ``n=41``, ``41**2+41+41`` is clearly divisible by 41. -The incredible formula n**2−79n+1601 was discovered, which produces 80 primes +The incredible formula ``n**2−79n+1601`` was discovered, which produces 80 primes for the consecutive values 0≤n≤79. The product of the coefficients, −79 and 1601, is −126479. @@ -19,9 +19,9 @@ n**2+an+b -, where |a|<1000 and |b|≤1000 +, where ``|a|<1000`` and ``|b|≤1000`` -where |n| is the modulus/absolute value of n, e.g. |11|=11 and |−4|=4 +where ``|n|`` is the modulus/absolute value of n, e.g. ``|11|=11`` and ``|−4|=4`` Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, From 39d29148b01851e7474becaab47f3d87ce38106d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 21:57:41 -0500 Subject: [PATCH 074/326] Add version to docs build --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 568b1fbb..658749a4 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -26,7 +26,7 @@ jobs: docs-folder: "docs/" build-command: "make html" - - uses: actions/upload-pages-artifact + - uses: actions/upload-pages-artifact@v4 with: path: docs/_build/html/ From b1098e2bd0da1f92ca9598ff0f238576d716a837 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 21:59:33 -0500 Subject: [PATCH 075/326] Fix version --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 658749a4..e17f59d0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -26,7 +26,7 @@ jobs: docs-folder: "docs/" build-command: "make html" - - uses: actions/upload-pages-artifact@v4 + - uses: actions/upload-pages-artifact@v3 with: path: docs/_build/html/ From c7b7a22fb28ab78ff2987940a9f1f3c430cd952d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 22:53:44 -0500 Subject: [PATCH 076/326] Try to build c, javascript docs --- .github/workflows/pages.yml | 2 ++ Makefile | 4 ++-- docs/c.rst | 3 +++ docs/c/p0001.rst | 8 ++++++++ docs/conf.py | 4 ++-- docs/javascript.rst | 2 ++ docs/javascript/p0001.rst | 6 ++++++ docs/requirements.txt | 5 ++++- 8 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 docs/c/p0001.rst create mode 100644 docs/javascript/p0001.rst diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e17f59d0..14fa200e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,6 +21,8 @@ jobs: c/requirements.txt docs/requirements.txt + - run: sudo apt-get install -y clang + - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" diff --git a/Makefile b/Makefile index 31c52d1b..6c39a920 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ PY?=python3 PROXY?= -html: - cd docs && $(make) $(MFLAGS) +html dirhtml singlehtml htmlhelp qthelp devhelp epub applehelp latex man texinfo text gettext doctest linkcheck xml pseudoxml: + cd docs && $(MAKE) $@ $(MFLAGS) py%: cd python && $(MAKE) $* $(MFLAGS) diff --git a/docs/c.rst b/docs/c.rst index b0866e1b..c1933f96 100644 --- a/docs/c.rst +++ b/docs/c.rst @@ -10,3 +10,6 @@ Problems Solved .. toctree:: :maxdepth: 1 + + c/p0001.rst + diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst new file mode 100644 index 00000000..7bda59a1 --- /dev/null +++ b/docs/c/p0001.rst @@ -0,0 +1,8 @@ +C Implementation of Problem 1 +============================= + +View source code `here on GitHub! `_ + +.. autocmodule:: ../p0001.c + :members: + :undoc-members: diff --git a/docs/conf.py b/docs/conf.py index 23f7fef6..a572e0e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,13 +27,13 @@ 'sphinx.ext.inheritance_diagram', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - # 'sphinx-c-autodoc', + 'sphinx-c-autodoc', # 'breathe', # 'javasphinx', # 'sphinx-autodoc-typehints', # 'sphinx-git', # 'sphinx-pyreverse', - # 'sphinxcontrib-autojs', + 'sphinxcontrib-autojs', # 'sphinx-csharp', ] diff --git a/docs/javascript.rst b/docs/javascript.rst index d1bc4f94..cdfaaf4d 100644 --- a/docs/javascript.rst +++ b/docs/javascript.rst @@ -10,3 +10,5 @@ Problems Solved .. toctree:: :maxdepth: 1 + + javascript/p0001.rst diff --git a/docs/javascript/p0001.rst b/docs/javascript/p0001.rst new file mode 100644 index 00000000..1529191e --- /dev/null +++ b/docs/javascript/p0001.rst @@ -0,0 +1,6 @@ +JavaScript Implementation of Problem 1 +====================================== + +View source code `here on GitHub! `_ + +.. autojs:: ../javascript/p0001.js diff --git a/docs/requirements.txt b/docs/requirements.txt index 93e1cf43..b4bfd1a2 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,6 @@ sphinx sphinx-rtd-theme -sphinx-git \ No newline at end of file +sphinx-git +sphinxcontrib-autojs +sphinx-c-autodoc +beautifulsoup4 \ No newline at end of file From fefd14a11f848166cd3bc758c95b7abeb40fd79e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 22:58:11 -0500 Subject: [PATCH 077/326] rename extensions --- docs/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a572e0e8..e7f9adc2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,6 +11,7 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') +c_autodoc_roots = [basedir + os.sep + 'c'] project = 'Euler' copyright = '2024, Olivia Appleton' @@ -27,13 +28,13 @@ 'sphinx.ext.inheritance_diagram', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - 'sphinx-c-autodoc', + 'sphinx_c_autodoc', # 'breathe', # 'javasphinx', # 'sphinx-autodoc-typehints', # 'sphinx-git', # 'sphinx-pyreverse', - 'sphinxcontrib-autojs', + 'sphinxcontrib_autojs', # 'sphinx-csharp', ] From 2c59cb834ede43ac29d4226d49a7925a9faf5f54 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:20:37 -0500 Subject: [PATCH 078/326] Temporarily disable js --- docs/conf.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e7f9adc2..c297e04f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,6 +12,7 @@ sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') c_autodoc_roots = [basedir + os.sep + 'c'] +js_source_path = basedir + os.sep + 'javascript' project = 'Euler' copyright = '2024, Olivia Appleton' @@ -31,11 +32,11 @@ 'sphinx_c_autodoc', # 'breathe', # 'javasphinx', - # 'sphinx-autodoc-typehints', - # 'sphinx-git', - # 'sphinx-pyreverse', - 'sphinxcontrib_autojs', - # 'sphinx-csharp', + # 'sphinx_autodoc_typehints', + 'sphinx_git', + # 'sphinx_pyreverse', + # 'sphinx_js', + # 'sphinx_csharp', ] templates_path = ['_templates'] @@ -46,7 +47,7 @@ # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -html_theme = 'agogo' +html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] # -- Options for todo extension ---------------------------------------------- From a2da1e6becfb07d00db67bd667018c0ddad4032b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:26:11 -0500 Subject: [PATCH 079/326] Enable sphinx-git, upgrade sphinx version --- docs/Makefile | 2 +- docs/index.rst | 8 ++++---- docs/javascript.rst | 2 +- docs/requirements.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index aa8967e6..7981c606 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -27,7 +27,7 @@ help: .PHONY: help Makefile dependencies: - $(PIP) install -r requirements.txt $(USER_FLAG) $(PROXY_ARG) + $(PIP) install -r requirements.txt --upgrade $(USER_FLAG) $(PROXY_ARG) cd ../python && $(MAKE) dependencies $(MFLAGS) # Catch-all target: route all unknown targets to Sphinx using the new diff --git a/docs/index.rst b/docs/index.rst index 4dc556f4..6d46d8dd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,8 +22,8 @@ Indices and tables * :ref:`modindex` * :ref:`search` -.. Recent Changes -.. ============== +Recent Changes +============== -.. .. git_changelog:: -.. :revisions: 16 \ No newline at end of file +.. git_changelog:: + :revisions: 16 \ No newline at end of file diff --git a/docs/javascript.rst b/docs/javascript.rst index cdfaaf4d..0b06711f 100644 --- a/docs/javascript.rst +++ b/docs/javascript.rst @@ -11,4 +11,4 @@ Problems Solved .. toctree:: :maxdepth: 1 - javascript/p0001.rst +.. javascript/p0001.rst diff --git a/docs/requirements.txt b/docs/requirements.txt index b4bfd1a2..2d6bb844 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,6 @@ -sphinx +sphinx>=3.1 sphinx-rtd-theme sphinx-git -sphinxcontrib-autojs +sphinx-js sphinx-c-autodoc beautifulsoup4 \ No newline at end of file From 1829ed5dd0bfc7d0221f933faa458e4189b73d37 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:30:15 -0500 Subject: [PATCH 080/326] Make sure git is installed --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 14fa200e..c8a9a8af 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,7 +21,7 @@ jobs: c/requirements.txt docs/requirements.txt - - run: sudo apt-get install -y clang + - run: sudo apt-get install -y clang git - uses: ammaraskar/sphinx-action@master with: From 8e427cfbb6661aed141fc851d87249d3d1e67f5e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:32:32 -0500 Subject: [PATCH 081/326] remove sphinx-git --- .github/workflows/pages.yml | 2 +- docs/conf.py | 1 - docs/index.rst | 6 ------ docs/requirements.txt | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c8a9a8af..14fa200e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,7 +21,7 @@ jobs: c/requirements.txt docs/requirements.txt - - run: sudo apt-get install -y clang git + - run: sudo apt-get install -y clang - uses: ammaraskar/sphinx-action@master with: diff --git a/docs/conf.py b/docs/conf.py index c297e04f..1ce0aca3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,7 +33,6 @@ # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', - 'sphinx_git', # 'sphinx_pyreverse', # 'sphinx_js', # 'sphinx_csharp', diff --git a/docs/index.rst b/docs/index.rst index 6d46d8dd..3a6dba7e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,9 +21,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - -Recent Changes -============== - -.. git_changelog:: - :revisions: 16 \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 2d6bb844..c1ea1c5d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,5 @@ sphinx>=3.1 sphinx-rtd-theme -sphinx-git sphinx-js sphinx-c-autodoc beautifulsoup4 \ No newline at end of file From bf9b1faefdd8165976cbf04f42381022a3186f0b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:35:48 -0500 Subject: [PATCH 082/326] attempt to correct file path --- docs/c/p0001.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst index 7bda59a1..84bf7a39 100644 --- a/docs/c/p0001.rst +++ b/docs/c/p0001.rst @@ -3,6 +3,6 @@ C Implementation of Problem 1 View source code `here on GitHub! `_ -.. autocmodule:: ../p0001.c +.. autocmodule:: ./p0001.c :members: :undoc-members: From f7c362c5567518f759492c0943fac77fc2d10924 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:54:19 -0500 Subject: [PATCH 083/326] Try c build again :( --- .github/workflows/pages.yml | 4 ++-- .github/workflows/python.yml | 2 +- README.rst | 8 +++++++- docs/c/p0001.rst | 2 +- docs/conf.py | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 14fa200e..70b3d5c1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,6 +11,8 @@ jobs: with: submodules: true + - run: sudo apt-get install -y clang + - name: Use Python 3.12 uses: actions/setup-python@v5 with: @@ -21,8 +23,6 @@ jobs: c/requirements.txt docs/requirements.txt - - run: sudo apt-get install -y clang - - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 479c98dc..3ab205c0 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,4 +1,4 @@ -name: Python +name: Py on: push diff --git a/README.rst b/README.rst index 1ae50162..60bf0c1d 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,10 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml .. |Python| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml -.. |CodeQL| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg +.. |CodeQL| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml +.. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml .. |br| raw:: html
@@ -34,6 +36,8 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------------+--------------+ | CodeQL Scanning | |CodeQL| | +-------------------------------------------------+--------------+ +| Documentation (in progress) | |Pages| | ++-------------------------------------------------+--------------+ This is the repository I keep for prospective employers to look at project Euler code that I have written. @@ -58,5 +62,7 @@ Makefile will direct recipes using prefixes - ``make cs*`` will go to the csharp Makefile - ``make py*`` will go to the python Makefile - ``make js*`` will go to the javascript Makefile +- Any make recipes supported by Sphinx will be redirected to the docs Makefile +- All other recipes will be run for all languages For more information, please see the README documents in each section. \ No newline at end of file diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst index 84bf7a39..f8dab56f 100644 --- a/docs/c/p0001.rst +++ b/docs/c/p0001.rst @@ -3,6 +3,6 @@ C Implementation of Problem 1 View source code `here on GitHub! `_ -.. autocmodule:: ./p0001.c +.. autocmodule:: p0001.c :members: :undoc-members: diff --git a/docs/conf.py b/docs/conf.py index 1ce0aca3..9d06252a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,6 +12,7 @@ sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') c_autodoc_roots = [basedir + os.sep + 'c'] +c_autodoc_compilation_args = ['-std=c11', '-DAMD_COMPILER=0'] js_source_path = basedir + os.sep + 'javascript' project = 'Euler' From c1bf2fc93bf96bbed228b4e42f06d0cb2563b62e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 30 Jun 2024 23:58:26 -0500 Subject: [PATCH 084/326] Maybe libclang will fix it? --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 70b3d5c1..c2d571bd 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,7 +11,7 @@ jobs: with: submodules: true - - run: sudo apt-get install -y clang + - run: sudo apt-get install -y clang libclang-dev - name: Use Python 3.12 uses: actions/setup-python@v5 From e7acb0e4696db7a11148b1efbcff44cfb9422f7e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 00:44:31 -0500 Subject: [PATCH 085/326] Try building like sphinx-c-autodoc does --- .github/workflows/pages.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c2d571bd..09e8dfa9 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -10,8 +10,22 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + + - name: Cache LLVM and Clang + id: cache-llvm + uses: actions/cache@v4 + with: + path: llvm/lib/libclang.so* + key: llvm-17 + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + cached: ${{ steps.cache-llvm.outputs.cache-hit }} - - run: sudo apt-get install -y clang libclang-dev + - name: Symlink libclang.so + run: sudo ln -s ./llvm/lib/libclang.so /usr/lib/x86_64-linux-gnu/libclang-17.so - name: Use Python 3.12 uses: actions/setup-python@v5 From fea2a67648e8e7b4e1ddc82af026936ba52b9848 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 00:50:07 -0500 Subject: [PATCH 086/326] Try building like sphinx-c-autodoc does (2) --- docs/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 9d06252a..0b3157f8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,3 +54,7 @@ # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration todo_include_todos = True + +if 'GITHUB_ACTION' in os.environ: + from clang import cindex + cindex.Config.set_library_file("/usr/lib/x86_64-linux-gnu/libclang-17.so") From 0387e8c9ae008d1afb0a01692bfb2d62bb5e80d7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 00:55:27 -0500 Subject: [PATCH 087/326] Try building like sphinx-c-autodoc does (3) --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 0b3157f8..e836d927 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,4 +57,4 @@ if 'GITHUB_ACTION' in os.environ: from clang import cindex - cindex.Config.set_library_file("/usr/lib/x86_64-linux-gnu/libclang-17.so") + cindex.Config.set_library_file("~/llvm/lib/libclang.so") From 2c02b529f5b0cbeeb8268a52aec96db46292763a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 00:58:43 -0500 Subject: [PATCH 088/326] Try building like sphinx-c-autodoc does (4) --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e836d927..a667caba 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,6 +55,6 @@ todo_include_todos = True -if 'GITHUB_ACTION' in os.environ: +if 'GITHUB_WORKSPACE' in os.environ: from clang import cindex - cindex.Config.set_library_file("~/llvm/lib/libclang.so") + cindex.Config.set_library_file(os.environ['GITHUB_WORKSPACE'] + os.sep + "/llvm/lib/libclang.so") From 82af274c8ae2577ffc5578c5f92fc46791482948 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:13:04 -0500 Subject: [PATCH 089/326] Install python3-clang from apt --- .github/workflows/pages.yml | 16 +--------------- docs/conf.py | 4 ---- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 09e8dfa9..84db3634 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -10,22 +10,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - - name: Cache LLVM and Clang - id: cache-llvm - uses: actions/cache@v4 - with: - path: llvm/lib/libclang.so* - key: llvm-17 - - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - version: "17.0" - cached: ${{ steps.cache-llvm.outputs.cache-hit }} - - name: Symlink libclang.so - run: sudo ln -s ./llvm/lib/libclang.so /usr/lib/x86_64-linux-gnu/libclang-17.so + - run: sudo apt-get install -y python3-clang - name: Use Python 3.12 uses: actions/setup-python@v5 diff --git a/docs/conf.py b/docs/conf.py index a667caba..9d06252a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,3 @@ # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration todo_include_todos = True - -if 'GITHUB_WORKSPACE' in os.environ: - from clang import cindex - cindex.Config.set_library_file(os.environ['GITHUB_WORKSPACE'] + os.sep + "/llvm/lib/libclang.so") From 9a100fea47e1d8e96122ced7672d2556f8d946b6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:29:30 -0500 Subject: [PATCH 090/326] maybe libclang will fix it? --- c/p0001.c | 28 ++++++++++++++-------------- docs/c/p0001.rst | 8 +++++--- docs/conf.py | 7 ++++--- docs/requirements.txt | 3 +-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/c/p0001.c b/c/p0001.c index 123ecc25..bd0f6356 100644 --- a/c/p0001.c +++ b/c/p0001.c @@ -1,17 +1,17 @@ -/* -Project Euler Problem 1 - -I know that this could be done faster with a traditional for loop, but I wanted -to see if iterators were reasonably possible in C, since it makes the prime -number infrastructure a lot easier to set up. - -Problem: - -If we list all the natural numbers below 10 that are multiples of 3 or 5, we -get 3, 5, 6 and 9. The sum of these multiples is 23. - -Find the sum of all the multiples of 3 or 5 below 1000. -*/ +/** + * Project Euler Problem 1 + * + * I know that this could be done faster with a traditional for loop, but I wanted + * to see if iterators were reasonably possible in C, since it makes the prime + * number infrastructure a lot easier to set up. + * + * Problem: + * + * If we list all the natural numbers below 10 that are multiples of 3 or 5, we + * get 3, 5, 6 and 9. The sum of these multiples is 23. + * + * Find the sum of all the multiples of 3 or 5 below 1000. + */ #ifndef EULER_P0001 #define EULER_P0001 #include diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst index f8dab56f..f808e2f8 100644 --- a/docs/c/p0001.rst +++ b/docs/c/p0001.rst @@ -3,6 +3,8 @@ C Implementation of Problem 1 View source code `here on GitHub! `_ -.. autocmodule:: p0001.c - :members: - :undoc-members: +.. c:autosection:: Project Euler Problem 1 + :file: p0001.c + +.. c:autodoc:: p0001.c + :clang: -std=c11 -DAMD_COMPILER=0 diff --git a/docs/conf.py b/docs/conf.py index 9d06252a..57f20dfe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,8 +11,9 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') -c_autodoc_roots = [basedir + os.sep + 'c'] -c_autodoc_compilation_args = ['-std=c11', '-DAMD_COMPILER=0'] +hawkmoth_root = basedir + os.sep + 'c' +hackmouth_clang = ['-std=c11', '-DAMD_COMPILER=0'] +hawmouth_source_uri = 'https://github.com/LivInTheLookingGlass/Euler/blob/master/{source}#L{line}' js_source_path = basedir + os.sep + 'javascript' project = 'Euler' @@ -30,7 +31,7 @@ 'sphinx.ext.inheritance_diagram', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - 'sphinx_c_autodoc', + 'hawkmoth', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', diff --git a/docs/requirements.txt b/docs/requirements.txt index c1ea1c5d..0386823d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,4 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js -sphinx-c-autodoc -beautifulsoup4 \ No newline at end of file +hawkmoth \ No newline at end of file From b39a0e84d00066ef5fe65dd6b3b840b4556aeb05 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:33:50 -0500 Subject: [PATCH 091/326] Try hawkmoth instead (2) --- .github/workflows/pages.yml | 2 -- docs/requirements.txt | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 84db3634..e17f59d0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,8 +11,6 @@ jobs: with: submodules: true - - run: sudo apt-get install -y python3-clang - - name: Use Python 3.12 uses: actions/setup-python@v5 with: diff --git a/docs/requirements.txt b/docs/requirements.txt index 0386823d..d1a18ce0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js -hawkmoth \ No newline at end of file +hawkmoth +clang \ No newline at end of file From b839fe9c30d2a90764483f90511cabb9c23a6ffa Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:36:32 -0500 Subject: [PATCH 092/326] Try using system python --- .github/workflows/pages.yml | 10 +--------- docs/requirements.txt | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e17f59d0..da527c99 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,15 +11,7 @@ jobs: with: submodules: true - - name: Use Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: 3.12 - cache: 'pip' - cache-dependency-path: | - python/requirements.txt - c/requirements.txt - docs/requirements.txt + - run: sudo apt-get install -y python3-clang python3-pip - uses: ammaraskar/sphinx-action@master with: diff --git a/docs/requirements.txt b/docs/requirements.txt index d1a18ce0..0386823d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,4 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js -hawkmoth -clang \ No newline at end of file +hawkmoth \ No newline at end of file From d82850ec5ccfbae8a1b958dc43a2ebf0ff59796b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:53:08 -0500 Subject: [PATCH 093/326] Try installing more system packages --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index da527c99..3f266da2 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,7 +11,7 @@ jobs: with: submodules: true - - run: sudo apt-get install -y python3-clang python3-pip + - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - uses: ammaraskar/sphinx-action@master with: From bf2945aea4d96748c50fde5b39f6839bc8b0ef47 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:54:20 -0500 Subject: [PATCH 094/326] Add clang back to requirements --- docs/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 0386823d..d1a18ce0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js -hawkmoth \ No newline at end of file +hawkmoth +clang \ No newline at end of file From 314603466557ac938783ee7357ff41f8ada592d9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 01:57:34 -0500 Subject: [PATCH 095/326] Set clang binding version --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index d1a18ce0..a2cf3fbf 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,4 +2,4 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js hawkmoth -clang \ No newline at end of file +clang==14 \ No newline at end of file From 64c7435483590c1d54fc2f25dbe795e25532b37b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 02:04:33 -0500 Subject: [PATCH 096/326] Debug commit --- .github/workflows/pages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3f266da2..149e0e03 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -13,6 +13,8 @@ jobs: - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang + - run: sudo dpkg -S libclang.so + - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" From d9a235ba88b6f69cdfa0bda7750332ed2a21ff61 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 02:16:45 -0500 Subject: [PATCH 097/326] Try hardcoding libclang.so path --- docs/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 57f20dfe..cd631106 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,3 +55,7 @@ # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration todo_include_todos = True + +if 'GITHUB_WORKSPACE' in os.environ: + from clang import cindex + cindex.Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so') From 86422c9346e2a75fb68a73d9b5b17f4817eb9a09 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 02:29:56 -0500 Subject: [PATCH 098/326] Try a different libclang.so path --- .github/workflows/pages.yml | 2 -- docs/conf.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 149e0e03..3f266da2 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -13,8 +13,6 @@ jobs: - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - - run: sudo dpkg -S libclang.so - - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" diff --git a/docs/conf.py b/docs/conf.py index cd631106..a69252d6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,4 +58,4 @@ if 'GITHUB_WORKSPACE' in os.environ: from clang import cindex - cindex.Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so') + cindex.Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so.1') From cd6a9c5ada10dcfa2a5da3707593b3d92610fc8b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:17:31 -0500 Subject: [PATCH 099/326] Enable js docs, disable failing c docs --- .github/workflows/pages.yml | 12 +++++++++++- docs/conf.py | 8 ++------ docs/javascript.rst | 3 ++- docs/javascript/p0001.rst | 2 +- docs/javascript/p0002.rst | 6 ++++++ javascript/p0000_template.js | 22 +++++++++++----------- javascript/p0001.js | 25 ++++++++++++------------- javascript/p0002.js | 33 ++++++++++++++++----------------- javascript/test.js | 2 +- 9 files changed, 62 insertions(+), 51 deletions(-) create mode 100644 docs/javascript/p0002.rst diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3f266da2..b3d5213d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,7 +11,17 @@ jobs: with: submodules: true - - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang + - name: Use Node.js 22 + uses: actions/setup-node@v3 + with: + node-version: 22 + cache: 'npm' + cache-dependency-path: 'javascript/package-lock.json' + + # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang + + - name: Install JavaScript dependencies + run: make jsdependencies && npm install -g jsdoc - uses: ammaraskar/sphinx-action@master with: diff --git a/docs/conf.py b/docs/conf.py index a69252d6..bd63f12b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,12 +31,12 @@ 'sphinx.ext.inheritance_diagram', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - 'hawkmoth', + # 'hawkmoth', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', # 'sphinx_pyreverse', - # 'sphinx_js', + 'sphinx_js', # 'sphinx_csharp', ] @@ -55,7 +55,3 @@ # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration todo_include_todos = True - -if 'GITHUB_WORKSPACE' in os.environ: - from clang import cindex - cindex.Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so.1') diff --git a/docs/javascript.rst b/docs/javascript.rst index 0b06711f..a7f38df5 100644 --- a/docs/javascript.rst +++ b/docs/javascript.rst @@ -11,4 +11,5 @@ Problems Solved .. toctree:: :maxdepth: 1 -.. javascript/p0001.rst + javascript/p0001.rst + javascript/p0002.rst diff --git a/docs/javascript/p0001.rst b/docs/javascript/p0001.rst index 1529191e..0f31f6c6 100644 --- a/docs/javascript/p0001.rst +++ b/docs/javascript/p0001.rst @@ -3,4 +3,4 @@ JavaScript Implementation of Problem 1 View source code `here on GitHub! `_ -.. autojs:: ../javascript/p0001.js +.. js:autofunction:: p0001 diff --git a/docs/javascript/p0002.rst b/docs/javascript/p0002.rst new file mode 100644 index 00000000..4db4648a --- /dev/null +++ b/docs/javascript/p0002.rst @@ -0,0 +1,6 @@ +JavaScript Implementation of Problem 2 +====================================== + +View source code `here on GitHub! `_ + +.. js:autofunction:: p0002 diff --git a/javascript/p0000_template.js b/javascript/p0000_template.js index 5ccc62c3..0b58ac05 100644 --- a/javascript/p0000_template.js +++ b/javascript/p0000_template.js @@ -1,13 +1,13 @@ -/* -Project Euler Template - -This template is used to format Project Euler solution scripts. This paragraph -should be replaced by a description of how I approached the problem, as well as -critque. - -This paragraph should be replaced by the problem description, excluding images. -*/ - -exports.main = function() { +/** + * Project Euler Template + * + * This template is used to format Project Euler solution scripts. This paragraph + * should be replaced by a description of how I approached the problem, as well as + * critque. + * + * This paragraph should be replaced by the problem description, excluding images. + **/ + +exports.p0000 = function() { }; diff --git a/javascript/p0001.js b/javascript/p0001.js index e027350d..0ac04d22 100644 --- a/javascript/p0001.js +++ b/javascript/p0001.js @@ -1,17 +1,16 @@ -/* -Project Euler Problem 1 - -Did this the old fashioned way, because this was before I figured out the closed form solution - -Problem: - -If we list all the natural numbers below 10 that are multiples of 3 or 5, we -get 3, 5, 6 and 9. The sum of these multiples is 23. - -Find the sum of all the multiples of 3 or 5 below 1000. +/** +* Project Euler Problem 1 +* +* Did this the old fashioned way, because this was before I figured out the closed form solution +* +* Problem: +* +* If we list all the natural numbers below 10 that are multiples of 3 or 5, we +* get 3, 5, 6 and 9. The sum of these multiples is 23. +* +* Find the sum of all the multiples of 3 or 5 below 1000. */ - -exports.main = function() { +exports.p0001 = function() { let answer = 0; for (let i = 3; i < 1000; i += 3) { answer += i; diff --git a/javascript/p0002.js b/javascript/p0002.js index 53e23430..d43ea72d 100644 --- a/javascript/p0002.js +++ b/javascript/p0002.js @@ -1,20 +1,19 @@ -/* -Project Euler Problem 2 - -Moved the fibonacci optimization to javascript - -Problem: - -Each new term in the Fibonacci sequence is generated by adding the previous two -terms. By starting with 1 and 2, the first 10 terms will be: - -1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... - -By considering the terms in the Fibonacci sequence whose values do not exceed -four million, find the sum of the even-valued terms. -*/ - -exports.main = function() { +/** + * Project Euler Problem 2 + * + * Moved the fibonacci optimization to javascript + * + * Problem: + * + * Each new term in the Fibonacci sequence is generated by adding the previous two + * terms. By starting with 1 and 2, the first 10 terms will be: + * + * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + * + * By considering the terms in the Fibonacci sequence whose values do not exceed + * four million, find the sum of the even-valued terms. + **/ +exports.p0002 = function() { // for a proof on why this formulation works, see python/p0002.py let answer = 0; let i = 2; diff --git a/javascript/test.js b/javascript/test.js index d2b64ca4..65a47eca 100644 --- a/javascript/test.js +++ b/javascript/test.js @@ -18,7 +18,7 @@ for (question in answers) { if (knownSlow.includes(question)) { this.timeout(-1); } - assert.equal(answer, module.main()); + assert.equal(answer, module[`p${formattedQuestion}`]()); }); it('should return take less than 1 minute', function(done) { this.timeout(-1); From 9435d43470b593cac1cda532981293d76424b4bc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:24:19 -0500 Subject: [PATCH 100/326] Make linter happy --- javascript/p0000_template.js | 4 ++-- javascript/p0001.js | 8 ++++---- javascript/p0002.js | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/javascript/p0000_template.js b/javascript/p0000_template.js index 0b58ac05..4d4bb7c2 100644 --- a/javascript/p0000_template.js +++ b/javascript/p0000_template.js @@ -1,10 +1,10 @@ /** * Project Euler Template - * + * * This template is used to format Project Euler solution scripts. This paragraph * should be replaced by a description of how I approached the problem, as well as * critque. - * + * * This paragraph should be replaced by the problem description, excluding images. **/ diff --git a/javascript/p0001.js b/javascript/p0001.js index 0ac04d22..346e0409 100644 --- a/javascript/p0001.js +++ b/javascript/p0001.js @@ -1,13 +1,13 @@ /** * Project Euler Problem 1 -* +* * Did this the old fashioned way, because this was before I figured out the closed form solution -* +* * Problem: -* +* * If we list all the natural numbers below 10 that are multiples of 3 or 5, we * get 3, 5, 6 and 9. The sum of these multiples is 23. -* +* * Find the sum of all the multiples of 3 or 5 below 1000. */ exports.p0001 = function() { diff --git a/javascript/p0002.js b/javascript/p0002.js index d43ea72d..c01b9056 100644 --- a/javascript/p0002.js +++ b/javascript/p0002.js @@ -1,15 +1,15 @@ /** * Project Euler Problem 2 - * + * * Moved the fibonacci optimization to javascript - * + * * Problem: - * + * * Each new term in the Fibonacci sequence is generated by adding the previous two * terms. By starting with 1 and 2, the first 10 terms will be: - * + * * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... - * + * * By considering the terms in the Fibonacci sequence whose values do not exceed * four million, find the sum of the even-valued terms. **/ From da1ff77836317ec19a3341ffc78491fa431178b5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:34:30 -0500 Subject: [PATCH 101/326] Fix jsdoc installation [no ci] --- .github/workflows/pages.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index b3d5213d..3d2ddf5c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,7 +21,9 @@ jobs: # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - name: Install JavaScript dependencies - run: make jsdependencies && npm install -g jsdoc + run: | + make jsdependencies + npm install -g jsdoc - uses: ammaraskar/sphinx-action@master with: From 8b4fe7805d3181ec46da37d44567559133986327 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:35:42 -0500 Subject: [PATCH 102/326] Allow workflow dispatch [no ci] --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3d2ddf5c..b07c48ce 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,6 +1,6 @@ name: Pages -on: push +on: [push, workflow_dispatch] jobs: build: From 52ca5062cc6015ba84c063a850b766e1277470c7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:54:05 -0500 Subject: [PATCH 103/326] Try moving where jsdoc is installed [no ci] --- .github/workflows/pages.yml | 4 +--- docs/Makefile | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index b07c48ce..80d5a3d8 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -21,9 +21,7 @@ jobs: # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - name: Install JavaScript dependencies - run: | - make jsdependencies - npm install -g jsdoc + run: make jsdependencies - uses: ammaraskar/sphinx-action@master with: diff --git a/docs/Makefile b/docs/Makefile index 7981c606..a9a311ec 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -29,6 +29,7 @@ help: dependencies: $(PIP) install -r requirements.txt --upgrade $(USER_FLAG) $(PROXY_ARG) cd ../python && $(MAKE) dependencies $(MFLAGS) + npm install -g jsdoc # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). From 2b175d4d7afb0b9bf041384440b19d65c12fafb2 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 03:55:35 -0500 Subject: [PATCH 104/326] Fix linter --- javascript/p0000_template.js | 2 ++ javascript/p0001.js | 24 +++++++++++++----------- javascript/p0002.js | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/javascript/p0000_template.js b/javascript/p0000_template.js index 4d4bb7c2..c71a2c30 100644 --- a/javascript/p0000_template.js +++ b/javascript/p0000_template.js @@ -6,6 +6,8 @@ * critque. * * This paragraph should be replaced by the problem description, excluding images. + * + * @returns {number} **/ exports.p0000 = function() { diff --git a/javascript/p0001.js b/javascript/p0001.js index 346e0409..3fd990cd 100644 --- a/javascript/p0001.js +++ b/javascript/p0001.js @@ -1,15 +1,17 @@ /** -* Project Euler Problem 1 -* -* Did this the old fashioned way, because this was before I figured out the closed form solution -* -* Problem: -* -* If we list all the natural numbers below 10 that are multiples of 3 or 5, we -* get 3, 5, 6 and 9. The sum of these multiples is 23. -* -* Find the sum of all the multiples of 3 or 5 below 1000. -*/ + * Project Euler Problem 1 + * + * Did this the old fashioned way, because this was before I figured out the closed form solution + * + * Problem: + * + * If we list all the natural numbers below 10 that are multiples of 3 or 5, we + * get 3, 5, 6 and 9. The sum of these multiples is 23. + * + * Find the sum of all the multiples of 3 or 5 below 1000. + * + * @returns {number} + */ exports.p0001 = function() { let answer = 0; for (let i = 3; i < 1000; i += 3) { diff --git a/javascript/p0002.js b/javascript/p0002.js index c01b9056..83237765 100644 --- a/javascript/p0002.js +++ b/javascript/p0002.js @@ -12,6 +12,8 @@ * * By considering the terms in the Fibonacci sequence whose values do not exceed * four million, find the sum of the even-valued terms. + * + * @returns {number} **/ exports.p0002 = function() { // for a proof on why this formulation works, see python/p0002.py From 3c7faf6bef39bf2b78faccd3f9bc818b398f5c51 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:03:58 -0500 Subject: [PATCH 105/326] Use filters to only sometimes trigger workflows --- .github/workflows/c.yml | 11 ++++++++++- .github/workflows/csharp.yml | 9 ++++++++- .github/workflows/javascript.yml | 8 +++++++- .github/workflows/pages.yml | 9 ++------- .github/workflows/python.yml | 8 +++++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 90b4da56..8e564ff5 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -1,6 +1,15 @@ name: C -on: push +on: + push: + paths: + - python/requirements.txt + - python/p0003.py + - python/p0007.py + - c/** + - Makefile + - _data/** + - .github/c.yml jobs: c-lint: diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index c0a59180..6d8704b3 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -1,6 +1,13 @@ name: C# -on: push +on: + push: + paths: + - csharp/** + - Euler.sln + - Makefile + - _data/** + - .github/csharp.yml jobs: csharp: diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index abbdc30c..7ebaf593 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -1,6 +1,12 @@ name: JS -on: push +on: + push: + paths: + - javascript/** + - Makefile + - _data/** + - .github/javascript.yml jobs: javascript-lint: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 80d5a3d8..5f8f02ec 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -20,13 +20,8 @@ jobs: # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - - name: Install JavaScript dependencies - run: make jsdependencies - - - uses: ammaraskar/sphinx-action@master - with: - docs-folder: "docs/" - build-command: "make html" + - name: Build sphinx docs + run: make docs - uses: actions/upload-pages-artifact@v3 with: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 3ab205c0..358296cc 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,6 +1,12 @@ name: Py -on: push +on: + push: + paths: + - python/** + - Makefile + - _data/** + - .github/python.yml jobs: # python-lint: From 45e8f5e459a04ed612dab3c29fbb7c17ca185504 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:05:18 -0500 Subject: [PATCH 106/326] JSDoc is so picky --- javascript/p0000_template.js | 2 +- javascript/p0001.js | 2 +- javascript/p0002.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/p0000_template.js b/javascript/p0000_template.js index c71a2c30..4f11b2d1 100644 --- a/javascript/p0000_template.js +++ b/javascript/p0000_template.js @@ -7,7 +7,7 @@ * * This paragraph should be replaced by the problem description, excluding images. * - * @returns {number} + * @return {number} **/ exports.p0000 = function() { diff --git a/javascript/p0001.js b/javascript/p0001.js index 3fd990cd..fecc081c 100644 --- a/javascript/p0001.js +++ b/javascript/p0001.js @@ -10,7 +10,7 @@ * * Find the sum of all the multiples of 3 or 5 below 1000. * - * @returns {number} + * @return {number} */ exports.p0001 = function() { let answer = 0; diff --git a/javascript/p0002.js b/javascript/p0002.js index 83237765..1742fd31 100644 --- a/javascript/p0002.js +++ b/javascript/p0002.js @@ -13,7 +13,7 @@ * By considering the terms in the Fibonacci sequence whose values do not exceed * four million, find the sum of the even-valued terms. * - * @returns {number} + * @return {number} **/ exports.p0002 = function() { // for a proof on why this formulation works, see python/p0002.py From a5d2c651a331418127fce75759e40e52bf6c8d57 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:11:36 -0500 Subject: [PATCH 107/326] fix make command --- .github/workflows/pages.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 5f8f02ec..e662a963 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -15,13 +15,11 @@ jobs: uses: actions/setup-node@v3 with: node-version: 22 - cache: 'npm' - cache-dependency-path: 'javascript/package-lock.json' # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - name: Build sphinx docs - run: make docs + run: make html - uses: actions/upload-pages-artifact@v3 with: From d9a88336ceb18fd202205eee9930bc1d10f68011 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:15:12 -0500 Subject: [PATCH 108/326] Merge usage, index --- docs/index.rst | 12 ++++++++++-- docs/usage.rst | 11 ----------- 2 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 docs/usage.rst diff --git a/docs/index.rst b/docs/index.rst index 3a6dba7e..3e7fa1b5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,10 +6,18 @@ Welcome to Euler's documentation! ================================= +This repo includes solutions in the following languages: + +.. include:: ../README.rst + :start-line: 2 + :end-before: This is the repository + +.. include:: ../README.rst + :start-after: If you are working on Project Euler problems, DO NOT use this as a source + .. toctree:: - :maxdepth: 1 + :maxdepth: 2 - usage c csharp javascript diff --git a/docs/usage.rst b/docs/usage.rst deleted file mode 100644 index 627840fb..00000000 --- a/docs/usage.rst +++ /dev/null @@ -1,11 +0,0 @@ -Euler Usage -=========== - -This repo includes solutions in the following languages: - -.. include:: ../README.rst - :start-line: 2 - :end-before: This is the repository - -.. include:: ../README.rst - :start-after: If you are working on Project Euler problems, DO NOT use this as a source \ No newline at end of file From ad97795a8af753ed45529b13fb8ff77990689687 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:18:17 -0500 Subject: [PATCH 109/326] Change header type --- docs/c.rst | 2 +- docs/csharp.rst | 2 +- docs/javascript.rst | 2 +- docs/python.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/c.rst b/docs/c.rst index c1933f96..b0cef963 100644 --- a/docs/c.rst +++ b/docs/c.rst @@ -6,7 +6,7 @@ Euler C Implementation :end-before: Problems Solved Problems Solved -~~~~~~~~~~~~~~~ +--------------- .. toctree:: :maxdepth: 1 diff --git a/docs/csharp.rst b/docs/csharp.rst index 28245eb9..bf53002f 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -6,7 +6,7 @@ Euler C# Implementation :end-before: Problems Solved Problems Solved -~~~~~~~~~~~~~~~ +--------------- .. toctree:: :maxdepth: 1 diff --git a/docs/javascript.rst b/docs/javascript.rst index a7f38df5..e9179ac5 100644 --- a/docs/javascript.rst +++ b/docs/javascript.rst @@ -6,7 +6,7 @@ Euler JavaScript Implementation :end-before: Problems Solved Problems Solved -~~~~~~~~~~~~~~~ +--------------- .. toctree:: :maxdepth: 1 diff --git a/docs/python.rst b/docs/python.rst index 5fc3ef15..7fac7c61 100644 --- a/docs/python.rst +++ b/docs/python.rst @@ -6,7 +6,7 @@ Euler Python Implementation :end-before: Problems Solved Problems Solved -~~~~~~~~~~~~~~~ +--------------- .. toctree:: :maxdepth: 1 From 178c9ae0471f5433f6c91b92b963fc935c6327af Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 04:34:52 -0500 Subject: [PATCH 110/326] Update readme, add parallel testing --- .github/workflows/javascript.yml | 7 ++++++- javascript/Makefile | 6 ++++-- javascript/README.rst | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 7ebaf593..38a6a72a 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -66,6 +66,11 @@ jobs: - name: Install dependencies run: make jsdependencies - - name: Run tests + - name: Run tests (serially) + if: ${{ matrix.version == 22 && matrix.os == 'ubuntu-latest' }} run: make jstest + - name: Run tests (in parallel) + if: ${{ !(matrix.version == 22 && matrix.os == 'ubuntu-latest') }} + run: make jstest_auto + diff --git a/javascript/Makefile b/javascript/Makefile index 2693d7c3..5c8e628a 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -4,9 +4,11 @@ HAS_NPM?=$(shell command -v npm > /dev/null 2>&1 ; echo $$?) test: dependencies npx mocha +test_auto: dependencies + npx mocha --parallel + test_%: dependencies - echo "WARNING: multithreaded tests not supported on javascript" - npx mocha + npx mocha -parallel -j $* ifneq ($(HAS_NPM),0) ifeq ($(OS),Windows_NT) # if no NPM and Windows diff --git a/javascript/README.rst b/javascript/README.rst index 50d2dead..b621546d 100644 --- a/javascript/README.rst +++ b/javascript/README.rst @@ -18,7 +18,7 @@ utilities for other problems to use. Makefile -------- -There are two main recipes in this Makefile +There are four main recipes in this Makefile dependencies ~~~~~~~~~~~~ @@ -34,6 +34,20 @@ each. This test infrastructure is based on mocha and benchmark.js, though it currently does not export benchmark info except to fail tests for time limit reasons. +test\_\* +~~~~~~~~ + +This recipe runs tests in the specified number of threads and performs +benchmarks on each. This test infrastructure is based on mocha and benchmark.js, +though it currently does not export benchmark info except to fail tests +for time limit reasons. If you specify the number of threads as `auto`, it +will default to using 1 fewer threads than you have CPUs. + +lint +~~~~ + +This recipe runs es-lint on the JavaScript files. + Tests ----- From 17f52aec128bd00349f4be99244476ff61b9e8e5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 1 Jul 2024 22:43:39 -0500 Subject: [PATCH 111/326] enable hawkmoth again [no ci] --- .github/workflows/pages.yml | 2 +- docs/conf.py | 6 +++--- python/p0044.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e662a963..cc91b579 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -16,7 +16,7 @@ jobs: with: node-version: 22 - # - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang + - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - name: Build sphinx docs run: make html diff --git a/docs/conf.py b/docs/conf.py index bd63f12b..24222f8f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,8 +12,8 @@ sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') hawkmoth_root = basedir + os.sep + 'c' -hackmouth_clang = ['-std=c11', '-DAMD_COMPILER=0'] -hawmouth_source_uri = 'https://github.com/LivInTheLookingGlass/Euler/blob/master/{source}#L{line}' +hawkmoth_clang = ['-std=c11', '-DAMD_COMPILER=0'] +hawkmoth_source_uri = 'https://github.com/LivInTheLookingGlass/Euler/blob/master/{source}#L{line}' js_source_path = basedir + os.sep + 'javascript' project = 'Euler' @@ -31,7 +31,7 @@ 'sphinx.ext.inheritance_diagram', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - # 'hawkmoth', + 'hawkmoth', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', diff --git a/python/p0044.py b/python/p0044.py index e30ac06d..fc108e34 100644 --- a/python/p0044.py +++ b/python/p0044.py @@ -9,7 +9,7 @@ It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal. -Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is +Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = ``|Pk − Pj|`` is minimised; what is the value of D? """ from itertools import islice From e5e05e4399f3b4affbb61f055093a847323c3581 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 15:06:59 -0500 Subject: [PATCH 112/326] Enable barebones csharp docs --- docs/c/p0001.rst | 4 ++++ docs/conf.py | 7 ++++--- docs/csharp.rst | 2 ++ docs/csharp/p0001.rst | 20 ++++++++++++++++++++ docs/javascript/p0001.rst | 4 ++++ docs/javascript/p0002.rst | 5 +++++ docs/python/p0001.rst | 5 +++++ docs/python/p0002.rst | 4 ++++ docs/python/p0003.rst | 4 ++++ docs/python/p0004.rst | 4 ++++ docs/python/p0005.rst | 4 ++++ docs/requirements.txt | 3 ++- 12 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 docs/csharp/p0001.rst diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst index f808e2f8..7c4665ae 100644 --- a/docs/c/p0001.rst +++ b/docs/c/p0001.rst @@ -8,3 +8,7 @@ View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: P0001 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task answer() + + An alas for :meth:`p0001` + + .. csharp:method:: Task p0001() + +.. literalinclude:: ../../csharp/Euler/p0001.cs + :language: csharp + :linenos: diff --git a/docs/javascript/p0001.rst b/docs/javascript/p0001.rst index 0f31f6c6..f1efcead 100644 --- a/docs/javascript/p0001.rst +++ b/docs/javascript/p0001.rst @@ -4,3 +4,7 @@ JavaScript Implementation of Problem 1 View source code `here on GitHub! `_ .. js:autofunction:: p0001 + +.. literalinclude:: ../../javascript/p0001.js + :language: javascript + :linenos: diff --git a/docs/javascript/p0002.rst b/docs/javascript/p0002.rst index 4db4648a..a0c52db1 100644 --- a/docs/javascript/p0002.rst +++ b/docs/javascript/p0002.rst @@ -4,3 +4,8 @@ JavaScript Implementation of Problem 2 View source code `here on GitHub! `_ .. js:autofunction:: p0002 + +.. literalinclude:: ../../javascript/p0002.js + :language: javascript + :linenos: + diff --git a/docs/python/p0001.rst b/docs/python/p0001.rst index 70bb251b..395288f8 100644 --- a/docs/python/p0001.rst +++ b/docs/python/p0001.rst @@ -6,3 +6,8 @@ View source code `here on GitHub! =3.1 sphinx-rtd-theme sphinx-js hawkmoth -clang==14 \ No newline at end of file +clang==14 +sphinx-csharp From 914ae2259f97c966916ca9658938ff4b7bd7d685 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 15:20:09 -0500 Subject: [PATCH 113/326] Continue documentation efforts --- docs/csharp.rst | 17 +++++++++++++++++ docs/csharp/p0001.rst | 12 ++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/csharp.rst b/docs/csharp.rst index 051b5e58..76758c52 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -5,6 +5,23 @@ Euler C# Implementation :start-line: 2 :end-before: Problems Solved +Test Infrastructure +------------------- + +.. csharp:namespace:: Euler + +.. csharp:interface:: Euler.IEuler + + .. csharp:method:: Task Answer + +.. csharp:namespace:: EulerTest + +.. csharp:class:: EulerTest + + .. csharp:method:: Task EulerTest_Problem + + An Xunit theory that, for each registered solution, will test against the known answer and a one minute time limit. + Problems Solved --------------- diff --git a/docs/csharp/p0001.rst b/docs/csharp/p0001.rst index fc827555..d68b909b 100644 --- a/docs/csharp/p0001.rst +++ b/docs/csharp/p0001.rst @@ -1,19 +1,15 @@ -C Implementation of Problem 1 -============================= +C# Implementation of Problem 1 +============================== View source code `here on GitHub! `_ .. csharp:namespace:: Euler -.. csharp:class:: P0001 +.. csharp:class:: p0001 .. csharp:inherits:: Euler.IEuler - .. csharp:method:: Task answer() - - An alas for :meth:`p0001` - - .. csharp:method:: Task p0001() + .. csharp:method:: Task Answer() .. literalinclude:: ../../csharp/Euler/p0001.cs :language: csharp From 16bdadd1954a9a3247238225c2880d314d52dd96 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 15:49:37 -0500 Subject: [PATCH 114/326] interface -> class --- docs/csharp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp.rst b/docs/csharp.rst index 76758c52..36e1d68a 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -10,7 +10,7 @@ Test Infrastructure .. csharp:namespace:: Euler -.. csharp:interface:: Euler.IEuler +.. csharp:class:: Euler.IEuler .. csharp:method:: Task Answer From 3fa500d42c220f71ecbd2098409306b526042386 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 16:09:21 -0500 Subject: [PATCH 115/326] fix signture, more literalincludes --- docs/csharp.rst | 4 ++-- docs/python/p0006.rst | 4 ++++ docs/python/p0007.rst | 4 ++++ docs/python/p0008.rst | 4 ++++ docs/python/p0009.rst | 4 ++++ docs/python/p0010.rst | 4 ++++ docs/python/p0011.rst | 4 ++++ docs/python/p0012.rst | 4 ++++ docs/python/p0013.rst | 4 ++++ docs/python/p0014.rst | 4 ++++ docs/python/p0015.rst | 4 ++++ docs/python/p0016.rst | 4 ++++ docs/python/p0017.rst | 4 ++++ docs/python/p0018.rst | 4 ++++ docs/python/p0019.rst | 4 ++++ docs/python/p0020.rst | 4 ++++ docs/python/p0021.rst | 4 ++++ docs/python/p0022.rst | 4 ++++ docs/python/p0023.rst | 4 ++++ docs/python/p0024.rst | 4 ++++ docs/python/p0025.rst | 4 ++++ docs/python/p0027.rst | 4 ++++ docs/python/p0029.rst | 4 ++++ docs/python/p0030.rst | 4 ++++ docs/python/p0031.rst | 4 ++++ docs/python/p0032.rst | 4 ++++ docs/python/p0033.rst | 4 ++++ docs/python/p0034.rst | 4 ++++ docs/python/p0035.rst | 4 ++++ docs/python/p0036.rst | 4 ++++ docs/python/p0037.rst | 4 ++++ docs/python/p0038.rst | 4 ++++ docs/python/p0039.rst | 4 ++++ docs/python/p0040.rst | 4 ++++ 34 files changed, 134 insertions(+), 2 deletions(-) diff --git a/docs/csharp.rst b/docs/csharp.rst index 36e1d68a..3f4845ce 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -12,13 +12,13 @@ Test Infrastructure .. csharp:class:: Euler.IEuler - .. csharp:method:: Task Answer + .. csharp:method:: Task Answer() .. csharp:namespace:: EulerTest .. csharp:class:: EulerTest - .. csharp:method:: Task EulerTest_Problem + .. csharp:method:: Task EulerTest_Problem() An Xunit theory that, for each registered solution, will test against the known answer and a one minute time limit. diff --git a/docs/python/p0006.rst b/docs/python/p0006.rst index 5efca0e8..6f0ef58f 100644 --- a/docs/python/p0006.rst +++ b/docs/python/p0006.rst @@ -6,3 +6,7 @@ View source code `here on GitHub! Date: Tue, 2 Jul 2024 17:33:31 -0500 Subject: [PATCH 116/326] add make clean (experimental) --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 6c39a920..9692fca3 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ PROXY?= html dirhtml singlehtml htmlhelp qthelp devhelp epub applehelp latex man texinfo text gettext doctest linkcheck xml pseudoxml: cd docs && $(MAKE) $@ $(MFLAGS) +clean: + rm -r docs/_build {c,python}/{*,*/*}.pyc csharp/*/{bin,obj,TestResults} javascript/node_modules || echo done + py%: cd python && $(MAKE) $* $(MFLAGS) From 474ccf5c95953e331ffd3a10bb526bd8a1eb01e1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 17:36:39 -0500 Subject: [PATCH 117/326] fix version --- csharp/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/README.rst b/csharp/README.rst index 65816dd0..51bbc28d 100644 --- a/csharp/README.rst +++ b/csharp/README.rst @@ -6,7 +6,7 @@ C# Section |C# Check| -All problems are solved in .NET 6, though an effort is made to support +All problems are solved in .NET 5, though an effort is made to support other versions. Organization From 3d84fa63dfd87dd5998059f366d20be1648b5532 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 17:36:48 -0500 Subject: [PATCH 118/326] more literalincludes --- docs/python/p0041.rst | 4 ++++ docs/python/p0042.rst | 4 ++++ docs/python/p0043.rst | 4 ++++ docs/python/p0044.rst | 4 ++++ docs/python/p0045.rst | 4 ++++ docs/python/p0046.rst | 4 ++++ docs/python/p0047.rst | 4 ++++ docs/python/p0048.rst | 4 ++++ docs/python/p0049.rst | 4 ++++ docs/python/p0050.rst | 4 ++++ docs/python/p0052.rst | 4 ++++ docs/python/p0053.rst | 4 ++++ docs/python/p0055.rst | 4 ++++ docs/python/p0056.rst | 4 ++++ docs/python/p0057.rst | 4 ++++ docs/python/p0059.rst | 4 ++++ docs/python/p0067.rst | 4 ++++ docs/python/p0069.rst | 4 ++++ docs/python/p0071.rst | 4 ++++ docs/python/p0073.rst | 4 ++++ docs/python/p0074.rst | 4 ++++ docs/python/p0076.rst | 4 ++++ docs/python/p0077.rst | 4 ++++ docs/python/p0087.rst | 4 ++++ docs/python/p0092.rst | 4 ++++ docs/python/p0097.rst | 4 ++++ docs/python/p0118.rst | 4 ++++ docs/python/p0123.rst | 4 ++++ docs/python/p0134.rst | 4 ++++ docs/python/p0145.rst | 4 ++++ docs/python/p0187.rst | 4 ++++ docs/python/p0206.rst | 4 ++++ 32 files changed, 128 insertions(+) diff --git a/docs/python/p0041.rst b/docs/python/p0041.rst index 4cd7957a..fc433355 100644 --- a/docs/python/p0041.rst +++ b/docs/python/p0041.rst @@ -6,3 +6,7 @@ View source code `here on GitHub! Date: Tue, 2 Jul 2024 20:51:37 -0500 Subject: [PATCH 119/326] Add initial rust implementation --- .github/workflows/rust.yml | 32 ++++ Makefile | 7 +- README.rst | 7 +- docs/Makefile | 3 +- docs/conf.py | 1 + docs/index.rst | 1 + docs/requirements.txt | 2 + docs/rust.rst | 14 ++ docs/rust/p0001.rst | 10 ++ rust/Cargo.lock | 331 +++++++++++++++++++++++++++++++++++++ rust/Cargo.toml | 7 + rust/Makefile | 11 ++ rust/README.rst | 62 +++++++ rust/src/main.rs | 22 +++ rust/src/p0001.rs | 13 ++ 15 files changed, 518 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/rust.yml create mode 100644 docs/rust.rst create mode 100644 docs/rust/p0001.rst create mode 100644 rust/Cargo.lock create mode 100644 rust/Cargo.toml create mode 100644 rust/Makefile create mode 100644 rust/README.rst create mode 100644 rust/src/main.rs create mode 100644 rust/src/p0001.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..de74184c --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,32 @@ +name: Rs + +on: + push: + paths: + - rust/** + - Makefile + - _data/** + - .github/rust.yml + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: Rust project - latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + toolchain: + - stable + - beta + - nightly + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + - run: cargo build --verbose + - run: cargo test --verbose diff --git a/Makefile b/Makefile index 9692fca3..558fc273 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PROXY?= html dirhtml singlehtml htmlhelp qthelp devhelp epub applehelp latex man texinfo text gettext doctest linkcheck xml pseudoxml: cd docs && $(MAKE) $@ $(MFLAGS) -clean: +clean: rsclean rm -r docs/_build {c,python}/{*,*/*}.pyc csharp/*/{bin,obj,TestResults} javascript/node_modules || echo done py%: @@ -19,5 +19,8 @@ c%: js%: cd javascript && $(MAKE) $* $(MFLAGS) +rs%: + cd rust && $(MAKE) $* $(MFLAGS) + %: - $(MAKE) c$* cs$* js$* py$* $(MFLAGS) + $(MAKE) c$* cs$* js$* py$* rs$* $(MFLAGS) diff --git a/README.rst b/README.rst index 60bf0c1d..ceb41cb3 100644 --- a/README.rst +++ b/README.rst @@ -9,6 +9,8 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml .. |Python| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml +.. |Rust| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml .. |CodeQL| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml .. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg @@ -34,6 +36,8 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+--------------+ +| Rust | | 1 / |total| | |Rust| | ++------------+---------------------+--------------+--------------+ | CodeQL Scanning | |CodeQL| | +-------------------------------------------------+--------------+ | Documentation (in progress) | |Pages| | @@ -62,7 +66,8 @@ Makefile will direct recipes using prefixes - ``make cs*`` will go to the csharp Makefile - ``make py*`` will go to the python Makefile - ``make js*`` will go to the javascript Makefile +- ``make rs*`` will go to the rust Makefile - Any make recipes supported by Sphinx will be redirected to the docs Makefile - All other recipes will be run for all languages -For more information, please see the README documents in each section. \ No newline at end of file +For more information, please see the README documents in each section. diff --git a/docs/Makefile b/docs/Makefile index a9a311ec..88507ce3 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -27,8 +27,7 @@ help: .PHONY: help Makefile dependencies: - $(PIP) install -r requirements.txt --upgrade $(USER_FLAG) $(PROXY_ARG) - cd ../python && $(MAKE) dependencies $(MFLAGS) + $(PIP) install -r requirements.txt -r ../c/requirements.txt -r ../python/requirements.txt --upgrade $(USER_FLAG) $(PROXY_ARG) npm install -g jsdoc # Catch-all target: route all unknown targets to Sphinx using the new diff --git a/docs/conf.py b/docs/conf.py index 1e51c08b..04ffd4d0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,6 +36,7 @@ # 'sphinx_autodoc_typehints', # 'sphinx_pyreverse', 'sphinx_csharp.csharp', + 'sphinx_rust', ] if 'TERMUX_VERSION' not in os.environ: extensions.append('hawkmoth') diff --git a/docs/index.rst b/docs/index.rst index 3e7fa1b5..c4c7630d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,6 +22,7 @@ This repo includes solutions in the following languages: csharp javascript python + rust Indices and tables ================== diff --git a/docs/requirements.txt b/docs/requirements.txt index 8621bd6d..d6de82c0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,5 @@ sphinx-js hawkmoth clang==14 sphinx-csharp +sphinx-rust + diff --git a/docs/rust.rst b/docs/rust.rst new file mode 100644 index 00000000..7051b17e --- /dev/null +++ b/docs/rust.rst @@ -0,0 +1,14 @@ +Euler Rust Implementation +========================= + +.. include:: ../rust/README.rst + :start-line: 2 + :end-before: Problems Solved + +Problems Solved +--------------- + +.. toctree:: + :maxdepth: 1 + + rust/p0001.rst diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst new file mode 100644 index 00000000..5dff2b4a --- /dev/null +++ b/docs/rust/p0001.rst @@ -0,0 +1,10 @@ +Rust Implementation of Problem 1 +================================ + +View source code `here on GitHub! `_ + +.. rust:function:: func p0001() -> u64 + +.. literalinclude:: ../../rust/p0001.rs + :language: rust + :linenos: diff --git a/rust/Cargo.lock b/rust/Cargo.lock new file mode 100644 index 00000000..442e2b5a --- /dev/null +++ b/rust/Cargo.lock @@ -0,0 +1,331 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + +[[package]] +name = "rstest" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afd55a67069d6e434a95161415f5beeada95a01c7b815508a82dcb0e1593682" +dependencies = [ + "futures", + "futures-timer", + "rstest_macros", + "rustc_version", +] + +[[package]] +name = "rstest_macros" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4165dfae59a39dd41d8dec720d3cbfbc71f69744efb480a3920f5d4e0cc6798d" +dependencies = [ + "cfg-if", + "glob", + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "relative-path", + "rustc_version", + "syn", + "unicode-ident", +] + +[[package]] +name = "rust" +version = "0.1.0" +dependencies = [ + "rstest", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "syn" +version = "2.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 00000000..33104c1f --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "rust" +version = "0.1.0" +edition = "2021" + +[dependencies] +rstest = "0.21.0" diff --git a/rust/Makefile b/rust/Makefile new file mode 100644 index 00000000..8e60aacb --- /dev/null +++ b/rust/Makefile @@ -0,0 +1,11 @@ +test: + cargo test + +test_auto: + cargo test -j + +test_%: + cargo test -j $* + +clean: + cargo clean diff --git a/rust/README.rst b/rust/README.rst new file mode 100644 index 00000000..882d4edc --- /dev/null +++ b/rust/README.rst @@ -0,0 +1,62 @@ +Rust Section +============ + +.. |Rust Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml + +|Rust Check| + +Organization +------------ + +All files share a common prefix with their problem number. All shared +functions are moved to files in the include subfolder + +Makefile +-------- + +There are three main recipes in this Makefile + +test +~~~~ + +Alias for ``cargo test`` + +test\_\* +~~~~~~~~ + +Runs ``cargo test`` with a number of threads determined by the recipe suffix. If you call +``make test_3`` it will use 3 threads. ``make yest_auto`` will let the test runner determine +the number of threads to use. + +clean +~~~~~ + +Alias for ``cargo clean`` + +Tests +----- + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will run it as many times +as the benchmark plugin wants. Otherwise it is run exactly once. + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are no non-test +dependencies for this section. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.rs>`__ + diff --git a/rust/src/main.rs b/rust/src/main.rs new file mode 100644 index 00000000..49e16072 --- /dev/null +++ b/rust/src/main.rs @@ -0,0 +1,22 @@ +use rstest::rstest; +mod p0001; + +const ANSWERS: [(&str, fn() -> u64, u64); 1] = [ + ("p0001", p0001::p0001, 233168) +]; + +fn main() { + for (name, func, answer) in ANSWERS { + let result = func(); + println!("Problem {} should return {}. Returned {}!", name, answer, result); + } +} + +#[rstest] +#[case(0)] +fn test_problem(#[case] idx: usize) -> Result<(), String> { + let (_, func, answer) = ANSWERS[idx]; + let result = func(); + assert_eq!(answer, result); + Ok(()) +} diff --git a/rust/src/p0001.rs b/rust/src/p0001.rs new file mode 100644 index 00000000..f79102ff --- /dev/null +++ b/rust/src/p0001.rs @@ -0,0 +1,13 @@ +pub fn p0001() -> u64 { + let mut answer: u64 = 0; + for i in (0..1000).step_by(3) { + answer += i; + } + for i in (0..1000).step_by(5) { + answer += i; + } + for i in (0..1000).step_by(15) { + answer -= i; + } + return answer; +} From 5139e45ece9381c036ea043cfe5ce6cb0a199bad Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:01:05 -0500 Subject: [PATCH 120/326] try slightly different syntax --- docs/rust/p0001.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index 5dff2b4a..e2b26e87 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:function:: func p0001() -> u64 +.. rust:function:: p0001::p0001 .. literalinclude:: ../../rust/p0001.rs :language: rust From bb3494306186930b7719f5d18d443177aa5d2ef9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:03:59 -0500 Subject: [PATCH 121/326] fix workflow --- .github/workflows/rust.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index de74184c..b7da1031 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -28,5 +28,4 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} - - run: cargo build --verbose - - run: cargo test --verbose + - run: make rstest From c41afe676e900bbaff8ca3e8866f77a8d8430120 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:06:08 -0500 Subject: [PATCH 122/326] fix file filter --- .github/workflows/c.yml | 2 +- .github/workflows/csharp.yml | 2 +- .github/workflows/javascript.yml | 2 +- .github/workflows/python.yml | 2 +- .github/workflows/rust.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 8e564ff5..3142da80 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -9,7 +9,7 @@ on: - c/** - Makefile - _data/** - - .github/c.yml + - .github/workflows/c.yml jobs: c-lint: diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 6d8704b3..bc0622cf 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -7,7 +7,7 @@ on: - Euler.sln - Makefile - _data/** - - .github/csharp.yml + - .github/workflows/csharp.yml jobs: csharp: diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 38a6a72a..9142e3a2 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -6,7 +6,7 @@ on: - javascript/** - Makefile - _data/** - - .github/javascript.yml + - .github/workflows/javascript.yml jobs: javascript-lint: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 358296cc..2f45a6a5 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -6,7 +6,7 @@ on: - python/** - Makefile - _data/** - - .github/python.yml + - .github/workflows/python.yml jobs: # python-lint: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b7da1031..b34e047e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -6,7 +6,7 @@ on: - rust/** - Makefile - _data/** - - .github/rust.yml + - .github/workflows/rust.yml env: CARGO_TERM_COLOR: always From 137196589a36478d834decb7d93227ae39d944a6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:36:35 -0500 Subject: [PATCH 123/326] test many more rust versions --- .github/workflows/rust.yml | 23 ++++++++++++++++++++++- README.rst | 10 +++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b34e047e..0bbc2b36 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,7 +21,28 @@ jobs: - stable - beta - nightly - os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + os: + - ubuntu-latest + - windows-latest + include: + - toolchain: stable + os: macos-13 + - toolchain: stable + os: macos-latest + - toolchain: "1.20" + os: ubuntu-latest + - toolchain: "1.28" + os: ubuntu-latest + - toolchain: "1.30" + os: ubuntu-latest + - toolchain: "1.40" + os: ubuntu-latest + - toolchain: "1.50" + os: ubuntu-latest + - toolchain: "1.60" + os: ubuntu-latest + - toolchain: "1.70" + os: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/README.rst b/README.rst index ceb41cb3..cdb0fb41 100644 --- a/README.rst +++ b/README.rst @@ -23,10 +23,10 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------------+--------------+ | Language | Version | Solved | Status | +============+=====================+==============+==============+ -| C | C11+ in: |br| | 17 / |total| | |C| | -| | ``gcc``, ``pcc``, | | | -| | ``tcc``, |br| | | | -| | ``clang``, ``msvc`` | | | +| C | C11+ in: ``gcc``, | 17 / |total| | |C| | +| | |br| ``clang``, | | | +| | ``msvc``, |br| | | | +| | ``pcc``, ``tcc`` | | | +------------+---------------------+--------------+--------------+ | C# | .NET 5+ | 1 / |total| | |C#| | +------------+---------------------+--------------+--------------+ @@ -36,7 +36,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+--------------+ -| Rust | | 1 / |total| | |Rust| | +| Rust | 1.28+ | 1 / |total| | |Rust| | +------------+---------------------+--------------+--------------+ | CodeQL Scanning | |CodeQL| | +-------------------------------------------------+--------------+ From 0495a02ea8745152b97fe97a180268dda44c34ce Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:40:38 -0500 Subject: [PATCH 124/326] even more rust versions --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0bbc2b36..99977405 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -29,6 +29,10 @@ jobs: os: macos-13 - toolchain: stable os: macos-latest + - toolchain: "1.1" + os: ubuntu-latest + - toolchain: "1.10" + os: ubuntu-latest - toolchain: "1.20" os: ubuntu-latest - toolchain: "1.28" From 55671207b4cd8bc07025404eceaeeb23dc2bf092 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:42:39 -0500 Subject: [PATCH 125/326] fix rust version --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cdb0fb41..aa2605d2 100644 --- a/README.rst +++ b/README.rst @@ -36,7 +36,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+--------------+ -| Rust | 1.28+ | 1 / |total| | |Rust| | +| Rust | 1.1+ | 1 / |total| | |Rust| | +------------+---------------------+--------------+--------------+ | CodeQL Scanning | |CodeQL| | +-------------------------------------------------+--------------+ From 40ebc9f318d8666a7688a191d451ce69ca34be65 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:50:42 -0500 Subject: [PATCH 126/326] try including more rust docs --- .github/workflows/pages.yml | 7 +++++++ docs/rust/p0001.rst | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index cc91b579..f9d1f07f 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -18,6 +18,13 @@ jobs: - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Compile rust crate + run: cd rust && cargo build + - name: Build sphinx docs run: make html diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index e2b26e87..f2bd80e4 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -5,6 +5,6 @@ View source code `here on GitHub! Date: Tue, 2 Jul 2024 21:55:28 -0500 Subject: [PATCH 127/326] typo --- rust/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/README.rst b/rust/README.rst index 882d4edc..22fd4400 100644 --- a/rust/README.rst +++ b/rust/README.rst @@ -26,7 +26,7 @@ test\_\* ~~~~~~~~ Runs ``cargo test`` with a number of threads determined by the recipe suffix. If you call -``make test_3`` it will use 3 threads. ``make yest_auto`` will let the test runner determine +``make test_3`` it will use 3 threads. ``make test_auto`` will let the test runner determine the number of threads to use. clean From 531f8212426c65767b2a6aa3e615618fe1284326 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 21:57:01 -0500 Subject: [PATCH 128/326] try more csharp versions --- .github/workflows/csharp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index bc0622cf..1c2f3486 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - net_version: [5, 6, 7, 8] + net_version: [1, 2, 3, 4, 5, 6, 7, 8] os: [ubuntu-latest] include: - net_version: 6 From 16e465b12e97030e17b363a1c4242a3a961d1a07 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 22:01:20 -0500 Subject: [PATCH 129/326] more csharp versions --- .github/workflows/csharp.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 1c2f3486..52bb1be4 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - net_version: [1, 2, 3, 4, 5, 6, 7, 8] + net_version: [5, 6, 7, 8] os: [ubuntu-latest] include: - net_version: 6 @@ -23,6 +23,14 @@ jobs: os: macos-13 - net_version: 6 os: windows-latest + - net_version: 1 + os: ubuntu-20.04 + - net_version: 2 + os: ubuntu-20.04 + - net_version: 3 + os: ubuntu-20.04 + - net_version: 4 + os: ubuntu-20.04 runs-on: ${{ matrix.os }} steps: From 4fe280684d4cc2300aeaa0ac4f0b4755ef73507e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 22:03:26 -0500 Subject: [PATCH 130/326] limit to 2+ --- .github/workflows/csharp.yml | 10 +--------- README.rst | 2 +- csharp/README.rst | 3 +-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 52bb1be4..547b41c8 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - net_version: [5, 6, 7, 8] + net_version: [2, 3, 5, 6, 7, 8, 9] os: [ubuntu-latest] include: - net_version: 6 @@ -23,14 +23,6 @@ jobs: os: macos-13 - net_version: 6 os: windows-latest - - net_version: 1 - os: ubuntu-20.04 - - net_version: 2 - os: ubuntu-20.04 - - net_version: 3 - os: ubuntu-20.04 - - net_version: 4 - os: ubuntu-20.04 runs-on: ${{ matrix.os }} steps: diff --git a/README.rst b/README.rst index aa2605d2..dbcdfdd2 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ LivInTheLookingGlass’s Project Euler solutions | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------------+--------------+ -| C# | .NET 5+ | 1 / |total| | |C#| | +| C# | .NET 2+ | 1 / |total| | |C#| | +------------+---------------------+--------------+--------------+ | JavaScript | Node 12+ | 2 / |total| | |JavaScript| | +------------+---------------------+--------------+--------------+ diff --git a/csharp/README.rst b/csharp/README.rst index 51bbc28d..3b042ba5 100644 --- a/csharp/README.rst +++ b/csharp/README.rst @@ -6,8 +6,7 @@ C# Section |C# Check| -All problems are solved in .NET 5, though an effort is made to support -other versions. +All problems are solved in .NET 2+. Organization ------------ From af3b8ef9e7a5d7f80aad78346c8e632e937151f2 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 23:52:49 -0500 Subject: [PATCH 131/326] switch to globs --- docs/c.rst | 5 ++-- docs/conf.py | 2 +- docs/csharp.rst | 4 ++- docs/javascript.rst | 6 ++-- docs/python.rst | 73 ++------------------------------------------- docs/rust.rst | 4 ++- 6 files changed, 17 insertions(+), 77 deletions(-) diff --git a/docs/c.rst b/docs/c.rst index b0cef963..b39a03b8 100644 --- a/docs/c.rst +++ b/docs/c.rst @@ -9,7 +9,8 @@ Problems Solved --------------- .. toctree:: + :glob: + :numbered: :maxdepth: 1 - c/p0001.rst - + c/p[0-9][0-9][0-9][0-9] diff --git a/docs/conf.py b/docs/conf.py index 04ffd4d0..f9f7fc7f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,11 +36,11 @@ # 'sphinx_autodoc_typehints', # 'sphinx_pyreverse', 'sphinx_csharp.csharp', - 'sphinx_rust', ] if 'TERMUX_VERSION' not in os.environ: extensions.append('hawkmoth') extensions.append('sphinx_js') + extensions.append('sphinx_rust') templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] diff --git a/docs/csharp.rst b/docs/csharp.rst index 3f4845ce..425bc7b9 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -26,6 +26,8 @@ Problems Solved --------------- .. toctree:: + :glob: + :numbered: :maxdepth: 1 - csharp/p0001.rst + csharp/p[0-9][0-9][0-9][0-9] diff --git a/docs/javascript.rst b/docs/javascript.rst index e9179ac5..7ecdfa6c 100644 --- a/docs/javascript.rst +++ b/docs/javascript.rst @@ -9,7 +9,9 @@ Problems Solved --------------- .. toctree:: + :glob: + :numbered: :maxdepth: 1 - javascript/p0001.rst - javascript/p0002.rst + javascript/p[0-9][0-9][0-9][0-9] + diff --git a/docs/python.rst b/docs/python.rst index 7fac7c61..7b801bc9 100644 --- a/docs/python.rst +++ b/docs/python.rst @@ -9,75 +9,8 @@ Problems Solved --------------- .. toctree:: + :glob: + :numbered: :maxdepth: 1 - python/p0001.rst - python/p0002.rst - python/p0003.rst - python/p0004.rst - python/p0005.rst - python/p0006.rst - python/p0007.rst - python/p0008.rst - python/p0009.rst - python/p0010.rst - python/p0011.rst - python/p0012.rst - python/p0013.rst - python/p0014.rst - python/p0015.rst - python/p0016.rst - python/p0017.rst - python/p0018.rst - python/p0019.rst - python/p0020.rst - python/p0021.rst - python/p0022.rst - python/p0023.rst - python/p0024.rst - python/p0025.rst - python/p0027.rst - python/p0029.rst - python/p0030.rst - python/p0031.rst - python/p0032.rst - python/p0033.rst - python/p0034.rst - python/p0035.rst - python/p0036.rst - python/p0037.rst - python/p0038.rst - python/p0039.rst - python/p0040.rst - python/p0041.rst - python/p0042.rst - python/p0043.rst - python/p0044.rst - python/p0045.rst - python/p0046.rst - python/p0047.rst - python/p0048.rst - python/p0049.rst - python/p0050.rst - python/p0052.rst - python/p0053.rst - python/p0055.rst - python/p0056.rst - python/p0057.rst - python/p0059.rst - python/p0067.rst - python/p0069.rst - python/p0071.rst - python/p0073.rst - python/p0074.rst - python/p0076.rst - python/p0077.rst - python/p0087.rst - python/p0092.rst - python/p0097.rst - python/p0118.rst - python/p0123.rst - python/p0134.rst - python/p0145.rst - python/p0187.rst - python/p0206.rst + python/p[0-9][0-9][0-9][0-9] diff --git a/docs/rust.rst b/docs/rust.rst index 7051b17e..c9923cf8 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -9,6 +9,8 @@ Problems Solved --------------- .. toctree:: + :glob: + :numbered: :maxdepth: 1 - rust/p0001.rst + rust/p[0-9][0-9][0-9][0-9] From b6cf7f5b0c340b5b5ee02d606bbb865331659d7d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 2 Jul 2024 23:56:00 -0500 Subject: [PATCH 132/326] try using package name --- docs/rust/p0001.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index f2bd80e4..97ceba55 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:function:: p0001::p0001 +.. rust:function:: rust::p0001::p0001 .. literalinclude:: ../../rust/src/p0001.rs :language: rust From 5558bf19dcde6f5a0cb324d2aaec68f424455c91 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 00:15:12 -0500 Subject: [PATCH 133/326] fill in some C gaps --- docs/c/p0002.rst | 14 ++++++++++++++ docs/c/p0003.rst | 14 ++++++++++++++ docs/c/p0004.rst | 14 ++++++++++++++ docs/c/p0005.rst | 14 ++++++++++++++ docs/c/p0006.rst | 14 ++++++++++++++ docs/c/p0007.rst | 14 ++++++++++++++ docs/c/p0008.rst | 14 ++++++++++++++ docs/c/p0009.rst | 14 ++++++++++++++ docs/c/p0010.rst | 14 ++++++++++++++ docs/c/p0011.rst | 14 ++++++++++++++ docs/c/p0012.rst | 14 ++++++++++++++ docs/c/p0013.rst | 14 ++++++++++++++ docs/c/p0014.rst | 14 ++++++++++++++ docs/c/p0015.rst | 14 ++++++++++++++ docs/c/p0016.rst | 14 ++++++++++++++ docs/c/p0034.rst | 14 ++++++++++++++ docs/c/p0076.rst | 14 ++++++++++++++ 17 files changed, 238 insertions(+) create mode 100644 docs/c/p0002.rst create mode 100644 docs/c/p0003.rst create mode 100644 docs/c/p0004.rst create mode 100644 docs/c/p0005.rst create mode 100644 docs/c/p0006.rst create mode 100644 docs/c/p0007.rst create mode 100644 docs/c/p0008.rst create mode 100644 docs/c/p0009.rst create mode 100644 docs/c/p0010.rst create mode 100644 docs/c/p0011.rst create mode 100644 docs/c/p0012.rst create mode 100644 docs/c/p0013.rst create mode 100644 docs/c/p0014.rst create mode 100644 docs/c/p0015.rst create mode 100644 docs/c/p0016.rst create mode 100644 docs/c/p0034.rst create mode 100644 docs/c/p0076.rst diff --git a/docs/c/p0002.rst b/docs/c/p0002.rst new file mode 100644 index 00000000..33b443a5 --- /dev/null +++ b/docs/c/p0002.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 2 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 2 + :file: p0002.c + +.. c:autodoc:: p0002.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0002.c + :language: C + :linenos: diff --git a/docs/c/p0003.rst b/docs/c/p0003.rst new file mode 100644 index 00000000..e2053165 --- /dev/null +++ b/docs/c/p0003.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 3 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 3 + :file: p0003.c + +.. c:autodoc:: p0003.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0003.c + :language: C + :linenos: diff --git a/docs/c/p0004.rst b/docs/c/p0004.rst new file mode 100644 index 00000000..39cf43e4 --- /dev/null +++ b/docs/c/p0004.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 4 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 4 + :file: p0004.c + +.. c:autodoc:: p0004.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0004.c + :language: C + :linenos: diff --git a/docs/c/p0005.rst b/docs/c/p0005.rst new file mode 100644 index 00000000..0ef72c88 --- /dev/null +++ b/docs/c/p0005.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 5 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 5 + :file: p0005.c + +.. c:autodoc:: p0005.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0005.c + :language: C + :linenos: diff --git a/docs/c/p0006.rst b/docs/c/p0006.rst new file mode 100644 index 00000000..22b43db4 --- /dev/null +++ b/docs/c/p0006.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 6 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 1 + :file: p0006.c + +.. c:autodoc:: p0006.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0006.c + :language: C + :linenos: diff --git a/docs/c/p0007.rst b/docs/c/p0007.rst new file mode 100644 index 00000000..50fbbefc --- /dev/null +++ b/docs/c/p0007.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 7 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 7 + :file: p0007.c + +.. c:autodoc:: p0007.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0007.c + :language: C + :linenos: diff --git a/docs/c/p0008.rst b/docs/c/p0008.rst new file mode 100644 index 00000000..f91a6103 --- /dev/null +++ b/docs/c/p0008.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 8 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 8 + :file: p0008.c + +.. c:autodoc:: p0008.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0008.c + :language: C + :linenos: diff --git a/docs/c/p0009.rst b/docs/c/p0009.rst new file mode 100644 index 00000000..be2cddd9 --- /dev/null +++ b/docs/c/p0009.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 9 +============================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 9 + :file: p0009.c + +.. c:autodoc:: p0009.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0009.c + :language: C + :linenos: diff --git a/docs/c/p0010.rst b/docs/c/p0010.rst new file mode 100644 index 00000000..7056ee42 --- /dev/null +++ b/docs/c/p0010.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 10 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 10 + :file: p0010.c + +.. c:autodoc:: p0010.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0010.c + :language: C + :linenos: diff --git a/docs/c/p0011.rst b/docs/c/p0011.rst new file mode 100644 index 00000000..19f1d04c --- /dev/null +++ b/docs/c/p0011.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 11 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 11 + :file: p0011.c + +.. c:autodoc:: p0011.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0011.c + :language: C + :linenos: diff --git a/docs/c/p0012.rst b/docs/c/p0012.rst new file mode 100644 index 00000000..54702088 --- /dev/null +++ b/docs/c/p0012.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 12 (port in progress) +================================================= + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 12 + :file: p0012.c + +.. c:autodoc:: p0012.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0012.c + :language: C + :linenos: diff --git a/docs/c/p0013.rst b/docs/c/p0013.rst new file mode 100644 index 00000000..0efc677b --- /dev/null +++ b/docs/c/p0013.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 13 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 13 + :file: p0013.c + +.. c:autodoc:: p0013.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0013.c + :language: C + :linenos: diff --git a/docs/c/p0014.rst b/docs/c/p0014.rst new file mode 100644 index 00000000..56fac882 --- /dev/null +++ b/docs/c/p0014.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 14 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 14 + :file: p0014.c + +.. c:autodoc:: p0014.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0014.c + :language: C + :linenos: diff --git a/docs/c/p0015.rst b/docs/c/p0015.rst new file mode 100644 index 00000000..b5b0f90a --- /dev/null +++ b/docs/c/p0015.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 15 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 15 + :file: p0015.c + +.. c:autodoc:: p0015.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0015.c + :language: C + :linenos: diff --git a/docs/c/p0016.rst b/docs/c/p0016.rst new file mode 100644 index 00000000..584c5fdf --- /dev/null +++ b/docs/c/p0016.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 16 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 16 + :file: p0016.c + +.. c:autodoc:: p0016.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0016.c + :language: C + :linenos: diff --git a/docs/c/p0034.rst b/docs/c/p0034.rst new file mode 100644 index 00000000..8c5def4f --- /dev/null +++ b/docs/c/p0034.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 34 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 34 + :file: p0034.c + +.. c:autodoc:: p0034.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0034.c + :language: C + :linenos: diff --git a/docs/c/p0076.rst b/docs/c/p0076.rst new file mode 100644 index 00000000..151be5ad --- /dev/null +++ b/docs/c/p0076.rst @@ -0,0 +1,14 @@ +C Implementation of Problem 76 +============================== + +View source code `here on GitHub! `_ + +.. c:autosection:: Project Euler Problem 76 + :file: p00076.c + +.. c:autodoc:: p0076.c + :clang: -std=c11 -DAMD_COMPILER=0 + +.. literalinclude:: ../../c/p0076.c + :language: C + :linenos: From df7b6260668348677251b551dd9eb50b27b2756e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 01:44:56 -0500 Subject: [PATCH 134/326] make rust test code more robust --- rust/Cargo.lock | 7 +++++++ rust/Cargo.toml | 1 + rust/src/main.rs | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 442e2b5a..f4589d10 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -261,6 +261,7 @@ name = "rust" version = "0.1.0" dependencies = [ "rstest", + "seq-macro", ] [[package]] @@ -278,6 +279,12 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "seq-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" + [[package]] name = "slab" version = "0.4.9" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 33104c1f..d7c37765 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] rstest = "0.21.0" +seq-macro = "0.3.5" diff --git a/rust/src/main.rs b/rust/src/main.rs index 49e16072..71c5ee55 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,4 +1,11 @@ +#[cfg(test)] +use std::time::Duration; + +#[cfg(test)] +use seq_macro::seq; +#[cfg(test)] use rstest::rstest; + mod p0001; const ANSWERS: [(&str, fn() -> u64, u64); 1] = [ @@ -12,11 +19,17 @@ fn main() { } } +#[cfg(test)] +seq!(N in 0..1 { #[rstest] -#[case(0)] +#[timeout(Duration::new(60, 0))] +#( +#[case(N)] +)* fn test_problem(#[case] idx: usize) -> Result<(), String> { let (_, func, answer) = ANSWERS[idx]; let result = func(); assert_eq!(answer, result); Ok(()) } +}); From a21a5c5287345b4b1073614613e59b020086ae2a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 01:48:15 -0500 Subject: [PATCH 135/326] Closes #25 --- c/p0009.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/p0009.c b/c/p0009.c index f82098bb..6b79d5dd 100644 --- a/c/p0009.c +++ b/c/p0009.c @@ -23,7 +23,7 @@ unsigned long long p0009() { for (unsigned int b = 2; b < c; b++) { unsigned int a = 1000 - c - b; if (a < b && a*a + b*b == c*c) { - answer = a * b * c; + answer = (unsigned long long) a * b * c; break; } } From 282147df6025fdb338f997f46f7624e45257e666 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 01:54:19 -0500 Subject: [PATCH 136/326] Create rust-clippy.yml --- .github/workflows/rust-clippy.yml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/rust-clippy.yml diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml new file mode 100644 index 00000000..03e47248 --- /dev/null +++ b/.github/workflows/rust-clippy.yml @@ -0,0 +1,55 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# rust-clippy is a tool that runs a bunch of lints to catch common +# mistakes in your Rust code and help improve your Rust code. +# More details at https://github.com/rust-lang/rust-clippy +# and https://rust-lang.github.io/rust-clippy/ + +name: rust-clippy analyze + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '32 21 * * 4' + +jobs: + rust-clippy-analyze: + name: Run rust-clippy analyzing + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 + with: + profile: minimal + toolchain: stable + components: clippy + override: true + + - name: Install required cargo + run: cargo install clippy-sarif sarif-fmt + + - name: Run rust-clippy + run: + cargo clippy + --all-features + --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + continue-on-error: true + + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: rust-clippy-results.sarif + wait-for-processing: true From 531291a449632a56cdd848b7cb3a4cdaaa31c724 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 01:55:18 -0500 Subject: [PATCH 137/326] Create eslint.yml --- .github/workflows/eslint.yml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 00000000..82b0ec73 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,50 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# ESLint is a tool for identifying and reporting on patterns +# found in ECMAScript/JavaScript code. +# More details at https://github.com/eslint/eslint +# and https://eslint.org + +name: ESLint + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '27 15 * * 5' + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install ESLint + run: | + npm install eslint@8.10.0 + npm install @microsoft/eslint-formatter-sarif@2.1.7 + + - name: Run ESLint + run: cd javascript && npx eslint . + --config .eslintrc.js + --ext .js,.jsx,.ts,.tsx + --format @microsoft/eslint-formatter-sarif + --output-file eslint-results.sarif + continue-on-error: true + + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: eslint-results.sarif + wait-for-processing: true From b2b2308dd7122fbc1024ef02b5e8cf04a2adf945 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 01:59:17 -0500 Subject: [PATCH 138/326] correct a path --- .github/workflows/eslint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 82b0ec73..337031ef 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -37,7 +37,7 @@ jobs: - name: Run ESLint run: cd javascript && npx eslint . - --config .eslintrc.js + --config .eslintrc --ext .js,.jsx,.ts,.tsx --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif From ed446a3b9e4e7e37f5af801b6da5de1dcee84c4a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 02:00:46 -0500 Subject: [PATCH 139/326] fix a path --- .github/workflows/eslint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 337031ef..18c2aab7 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -40,7 +40,7 @@ jobs: --config .eslintrc --ext .js,.jsx,.ts,.tsx --format @microsoft/eslint-formatter-sarif - --output-file eslint-results.sarif + --output-file ../eslint-results.sarif continue-on-error: true - name: Upload analysis results to GitHub From cac466fc930d671a8270e4a92887f0ebeb174a85 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 02:04:13 -0500 Subject: [PATCH 140/326] add dependency --- .github/workflows/eslint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 18c2aab7..408957e2 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -32,7 +32,7 @@ jobs: - name: Install ESLint run: | - npm install eslint@8.10.0 + npm install eslint@8.10.0 eslint-config-google npm install @microsoft/eslint-formatter-sarif@2.1.7 - name: Run ESLint @@ -41,7 +41,6 @@ jobs: --ext .js,.jsx,.ts,.tsx --format @microsoft/eslint-formatter-sarif --output-file ../eslint-results.sarif - continue-on-error: true - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v2 From e5ab1d8305af92ae520351a2d7a3de225d92af6a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 18:09:38 -0500 Subject: [PATCH 141/326] Port Javascript solution to rust, c# --- .github/workflows/javascript.yml | 18 ----------- .github/workflows/rust-clippy.yml | 2 +- .mailmap | 4 +++ README.rst | 54 +++++++++++++++++-------------- csharp/Euler.Test/test.cs | 1 + csharp/Euler/p0002.cs | 39 ++++++++++++++++++++++ docs/conf.py | 2 +- docs/csharp/p0001.rst | 2 +- docs/csharp/p0002.rst | 16 +++++++++ docs/rust/p0001.rst | 2 +- docs/rust/p0002.rst | 10 ++++++ rust/src/main.rs | 2 ++ rust/src/p0001.rs | 13 ++++++++ rust/src/p0002.rs | 29 +++++++++++++++++ 14 files changed, 148 insertions(+), 46 deletions(-) create mode 100644 .mailmap create mode 100644 csharp/Euler/p0002.cs create mode 100644 docs/csharp/p0002.rst create mode 100644 docs/rust/p0002.rst create mode 100644 rust/src/p0002.rs diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 9142e3a2..8f794a88 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -9,24 +9,6 @@ on: - .github/workflows/javascript.yml jobs: - javascript-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 22 - uses: actions/setup-node@v3 - with: - node-version: 22 - cache: 'npm' - cache-dependency-path: 'javascript/package-lock.json' - - - name: Fetch ESLint - run: make jsdependencies; npm install eslint-config-google@latest eslint@>=5.16.0 - - - name: Lint - run: make jslint - javascript: strategy: fail-fast: false diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 03e47248..d048ee36 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -7,7 +7,7 @@ # More details at https://github.com/rust-lang/rust-clippy # and https://rust-lang.github.io/rust-clippy/ -name: rust-clippy analyze +name: Rust-Clippy on: push: diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..34cd1145 --- /dev/null +++ b/.mailmap @@ -0,0 +1,4 @@ +Olivia Appleton Gabe Appleton +Olivia Appleton Gabe Appleton +Olivia Appleton Olivia Appleton +Olivia Appleton Olivia Appleton \ No newline at end of file diff --git a/README.rst b/README.rst index dbcdfdd2..d9e54978 100644 --- a/README.rst +++ b/README.rst @@ -13,35 +13,41 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml .. |CodeQL| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml +.. |ESLint| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml +.. |RustClippy| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml .. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml .. |br| raw:: html
-.. |total| replace:: 642 +.. |total| replace:: 897 -+------------+---------------------+--------------+--------------+ -| Language | Version | Solved | Status | -+============+=====================+==============+==============+ -| C | C11+ in: ``gcc``, | 17 / |total| | |C| | -| | |br| ``clang``, | | | -| | ``msvc``, |br| | | | -| | ``pcc``, ``tcc`` | | | -+------------+---------------------+--------------+--------------+ -| C# | .NET 2+ | 1 / |total| | |C#| | -+------------+---------------------+--------------+--------------+ -| JavaScript | Node 12+ | 2 / |total| | |JavaScript| | -+------------+---------------------+--------------+--------------+ -| Python | CPython 3.6+ |br| | 70 / |total| | |Python| | -| | Pypy 3.8+ |br| | | | -| | GraalPy 23.1+ | | | -+------------+---------------------+--------------+--------------+ -| Rust | 1.1+ | 1 / |total| | |Rust| | -+------------+---------------------+--------------+--------------+ -| CodeQL Scanning | |CodeQL| | -+-------------------------------------------------+--------------+ -| Documentation (in progress) | |Pages| | -+-------------------------------------------------+--------------+ ++------------+---------------------+--------------+---------------+ +| Language | Version | Solved | Status | ++============+=====================+==============+===============+ +| C | C11+ in: ``gcc``, | 17 / |total| | |C| | +| | |br| ``clang``, | | | +| | ``msvc``, |br| | | | +| | ``pcc``, ``tcc`` | | | ++------------+---------------------+--------------+---------------+ +| C# | .NET 2+ | 2 / |total| | |C#| | ++------------+---------------------+--------------+---------------+ +| JavaScript | Node 12+ | 2 / |total| | |JavaScript| | ++------------+---------------------+--------------+---------------+ +| Python | CPython 3.6+ |br| | 70 / |total| | |Python| | +| | Pypy 3.8+ |br| | | | +| | GraalPy 23.1+ | | | ++------------+---------------------+--------------+---------------+ +| Rust | 1.1+ | 2 / |total| | |Rust| | ++------------+---------------------+--------------+---------------+ +| Documentation (in progress) | |Pages| | ++-------------------------------------------------+---------------+ +| Code Scanning | |CodeQL| |br| | +| | |ESLint| |br| | +| | |RustClippy| | ++-------------------------------------------------+---------------+ This is the repository I keep for prospective employers to look at project Euler code that I have written. @@ -64,8 +70,8 @@ Makefile will direct recipes using prefixes - ``make c*`` will go to the c Makefile - ``make cs*`` will go to the csharp Makefile -- ``make py*`` will go to the python Makefile - ``make js*`` will go to the javascript Makefile +- ``make py*`` will go to the python Makefile - ``make rs*`` will go to the rust Makefile - Any make recipes supported by Sphinx will be redirected to the docs Makefile - All other recipes will be run for all languages diff --git a/csharp/Euler.Test/test.cs b/csharp/Euler.Test/test.cs index 4233e3fc..930c08c6 100644 --- a/csharp/Euler.Test/test.cs +++ b/csharp/Euler.Test/test.cs @@ -9,6 +9,7 @@ public static IEnumerable Data() { yield return new object[] { typeof(p0000), 0 }; yield return new object[] { typeof(p0001), 233168 }; + yield return new object[] { typeof(p0002), 4613732 }; } [Theory] diff --git a/csharp/Euler/p0002.cs b/csharp/Euler/p0002.cs new file mode 100644 index 00000000..b8a9108a --- /dev/null +++ b/csharp/Euler/p0002.cs @@ -0,0 +1,39 @@ +/* +Project Euler Problem 2 + +This is a port of the optimized version found in python. For a proof of why this +works, see that implementation + +Problem: + +Each new term in the Fibonacci sequence is generated by adding the previous two +terms. By starting with 1 and 2, the first 10 terms will be: + +1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + +By considering the terms in the Fibonacci sequence whose values do not exceed +four million, find the sum of the even-valued terms. +*/ +using System; + +namespace Euler +{ + public class p0002 : IEuler + { + public Task Answer() + { + Int64 answer = 0, + i = 2, + j = 8, + tmp = 0; + while (i < 4000000) + { + answer += i; + tmp = 4 * j + i; + i = j; + j = tmp; + } + return Task.FromResult(answer); + } + } +} diff --git a/docs/conf.py b/docs/conf.py index f9f7fc7f..7b984b3e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,7 +38,7 @@ 'sphinx_csharp.csharp', ] if 'TERMUX_VERSION' not in os.environ: - extensions.append('hawkmoth') + # extensions.append('hawkmoth') extensions.append('sphinx_js') extensions.append('sphinx_rust') diff --git a/docs/csharp/p0001.rst b/docs/csharp/p0001.rst index d68b909b..ef973d16 100644 --- a/docs/csharp/p0001.rst +++ b/docs/csharp/p0001.rst @@ -1,7 +1,7 @@ C# Implementation of Problem 1 ============================== -View source code `here on GitHub! `_ +View source code `here on GitHub! `_ .. csharp:namespace:: Euler diff --git a/docs/csharp/p0002.rst b/docs/csharp/p0002.rst new file mode 100644 index 00000000..a4b28bd8 --- /dev/null +++ b/docs/csharp/p0002.rst @@ -0,0 +1,16 @@ +C# Implementation of Problem 2 +============================== + +View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: p0002 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task Answer() + +.. literalinclude:: ../../csharp/Euler/p0002.cs + :language: csharp + :linenos: diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index 97ceba55..8368663b 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -1,7 +1,7 @@ Rust Implementation of Problem 1 ================================ -View source code `here on GitHub! `_ +View source code `here on GitHub! `_ .. rust:function:: rust::p0001::p0001 diff --git a/docs/rust/p0002.rst b/docs/rust/p0002.rst new file mode 100644 index 00000000..b20acaa5 --- /dev/null +++ b/docs/rust/p0002.rst @@ -0,0 +1,10 @@ +Rust Implementation of Problem 2 +================================ + +View source code `here on GitHub! `_ + +.. rust:function:: rust::p0002::p0002 + +.. literalinclude:: ../../rust/src/p0002.rs + :language: rust + :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 71c5ee55..116b3c2f 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -7,9 +7,11 @@ use seq_macro::seq; use rstest::rstest; mod p0001; +mod p0002; const ANSWERS: [(&str, fn() -> u64, u64); 1] = [ ("p0001", p0001::p0001, 233168) + ("p0002", p0002::p0002, 4613732) ]; fn main() { diff --git a/rust/src/p0001.rs b/rust/src/p0001.rs index f79102ff..4176b8f2 100644 --- a/rust/src/p0001.rs +++ b/rust/src/p0001.rs @@ -1,3 +1,16 @@ +/* +Project Euler Problem 1 + +I did this in the traditional way, as I'm mostly using this folder as a way +to learn Rust + +Problem: + +If we list all the natural numbers below 10 that are multiples of 3 or 5, we +get 3, 5, 6 and 9. The sum of these multiples is 23. + +Find the sum of all the multiples of 3 or 5 below 1000. +*/ pub fn p0001() -> u64 { let mut answer: u64 = 0; for i in (0..1000).step_by(3) { diff --git a/rust/src/p0002.rs b/rust/src/p0002.rs new file mode 100644 index 00000000..db870d4c --- /dev/null +++ b/rust/src/p0002.rs @@ -0,0 +1,29 @@ +/* +Project Euler Problem 2 + +This is a port of the optimized version found in python. For a proof of why this +works, see that implementation + +Problem: + +Each new term in the Fibonacci sequence is generated by adding the previous two +terms. By starting with 1 and 2, the first 10 terms will be: + +1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + +By considering the terms in the Fibonacci sequence whose values do not exceed +four million, find the sum of the even-valued terms. +*/ +pub fn p0002() -> u64 { + let mut answer = 0; + let mut i = 2; + let mut j = 8; + let mut tmp = 0; + while i < 4000000 { + answer += i; + tmp = 4 * j + i; + i = j; + j = tmp; + } + return answer; +} From ef66bb28ecc192ff6f8de6de5d71eac58eaed971 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 22:10:05 -0500 Subject: [PATCH 142/326] fix rust tests --- rust/src/main.rs | 6 +++--- rust/src/p0002.rs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index 116b3c2f..e433af1b 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,8 +9,8 @@ use rstest::rstest; mod p0001; mod p0002; -const ANSWERS: [(&str, fn() -> u64, u64); 1] = [ - ("p0001", p0001::p0001, 233168) +const ANSWERS: [(&str, fn() -> u64, u64); 2] = [ + ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732) ]; @@ -22,7 +22,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..1 { +seq!(N in 0..2 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0002.rs b/rust/src/p0002.rs index db870d4c..68246133 100644 --- a/rust/src/p0002.rs +++ b/rust/src/p0002.rs @@ -18,10 +18,9 @@ pub fn p0002() -> u64 { let mut answer = 0; let mut i = 2; let mut j = 8; - let mut tmp = 0; while i < 4000000 { answer += i; - tmp = 4 * j + i; + let tmp = 4 * j + i; i = j; j = tmp; } From 5a968056020f89e47e37ac65f1be1e51a9a89bda Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 22:14:22 -0500 Subject: [PATCH 143/326] fix rust-clippy target --- .github/workflows/rust-clippy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index d048ee36..b4fe35a3 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -43,7 +43,7 @@ jobs: - name: Run rust-clippy run: - cargo clippy + cargo clippy -p rust --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt continue-on-error: true From 4e3df40da14eb69940e37141d3893b01421be11d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 3 Jul 2024 22:17:43 -0500 Subject: [PATCH 144/326] fix target, disable continue-on-error --- .github/workflows/rust-clippy.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index b4fe35a3..7d44f188 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -43,10 +43,9 @@ jobs: - name: Run rust-clippy run: - cargo clippy -p rust + cd rust && cargo clippy --all-features - --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - continue-on-error: true + --message-format=json | clippy-sarif | tee ../rust-clippy-results.sarif | sarif-fmt - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v1 From 27075e90846e0b7ecf9a31f154cb026ba1079e6b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 13:37:04 -0500 Subject: [PATCH 145/326] cache apt packages, fix rust compile for docs (hopefully) --- .github/workflows/c.yml | 5 ++++- .github/workflows/pages.yml | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 3142da80..47e788ba 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -51,8 +51,11 @@ jobs: cache-dependency-path: '*/requirements.txt' - name: Setup tcc, pcc + uses: awalsh128/cache-apt-pkgs-action@latest if: ${{ matrix.os == 'ubuntu-latest' }} - run: sudo apt-get install -y tcc pcc + with: + packages: tcc pcc + version: 1.0 - name: Setup MSVC uses: aminya/setup-cpp@v1 diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index f9d1f07f..00356ecc 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,19 +11,24 @@ jobs: with: submodules: true + - name: Install system dependencies + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: python3-clang python3-pip libclang-dev clang + version: 1.0 + - name: Use Node.js 22 uses: actions/setup-node@v3 with: node-version: 22 - - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang - - - uses: actions-rs/toolchain@v1 + - name: Use Rust stable + uses: actions-rs/toolchain@v1 with: toolchain: stable - name: Compile rust crate - run: cd rust && cargo build + run: cd docs && cargo build --manifest-path ../rust/Cargo.toml - name: Build sphinx docs run: make html From 2f1ad115227fb6f5557dc0f4229e3372cd741b5d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 13:39:36 -0500 Subject: [PATCH 146/326] cache clang-tidy --- .github/workflows/c.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 47e788ba..7a768882 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -20,7 +20,10 @@ jobs: submodules: true - name: Setup clang-tidy - run: sudo apt-get install -y clang-tidy + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: clang-tidy + version: 1.0 - name: Run tests run: make clint From 91c289dc52c2c2f225a4e60775a4fce5a7789111 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 22:54:03 -0500 Subject: [PATCH 147/326] attempt makefile docs --- docs/conf.py | 1 + docs/index.rst | 19 +++++++++++++++++++ docs/requirements.txt | 3 +-- docs/rust/p0001.rst | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7b984b3e..691b6a5b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,6 +36,7 @@ # 'sphinx_autodoc_typehints', # 'sphinx_pyreverse', 'sphinx_csharp.csharp', + 'sphinxcontrib.makedomain', ] if 'TERMUX_VERSION' not in os.environ: # extensions.append('hawkmoth') diff --git a/docs/index.rst b/docs/index.rst index c4c7630d..9bb7359c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,6 +15,25 @@ This repo includes solutions in the following languages: .. include:: ../README.rst :start-after: If you are working on Project Euler problems, DO NOT use this as a source +Usage +----- + +This project is divided into several Makefiles, connected by a root Makefile which redirects commands whever necessary. + +.. highlight:: make + +.. make:target:: cs% + +.. make:target:: c% + +.. make:target:: js% + +.. make:target:: py% + +.. make:target:: rs% + +.. make:target:: % + .. toctree:: :maxdepth: 2 diff --git a/docs/requirements.txt b/docs/requirements.txt index d6de82c0..451e7377 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,5 +4,4 @@ sphinx-js hawkmoth clang==14 sphinx-csharp -sphinx-rust - +sphinxcontrib-makedomain diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index 8368663b..05aa64a4 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:function:: rust::p0001::p0001 +.. rust:function:: p0001::p0001 .. literalinclude:: ../../rust/src/p0001.rs :language: rust From 665edac4c71bb799798fd28e0bbd140625716391 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 22:55:46 -0500 Subject: [PATCH 148/326] add missed requirement --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 451e7377..6499f65a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,3 +5,4 @@ hawkmoth clang==14 sphinx-csharp sphinxcontrib-makedomain +sphinx_rust From 5eadda52f658321e4e59a2083c39f33b4d7d5b96 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 23:18:01 -0500 Subject: [PATCH 149/326] More Makefile docs --- docs/index.rst | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 9bb7359c..a30352ae 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,9 +12,6 @@ This repo includes solutions in the following languages: :start-line: 2 :end-before: This is the repository -.. include:: ../README.rst - :start-after: If you are working on Project Euler problems, DO NOT use this as a source - Usage ----- @@ -22,18 +19,64 @@ This project is divided into several Makefiles, connected by a root Makefile whi .. highlight:: make +.. make:var:: PY + + A string that contains the command used for your Python interpreter. Defaults to ``python3``. + +.. make:target:: clean + + Removes all temporary or cache files, as well as any build artifacts + +.. make:target:: html + + This recipe redirects to the docs Makefile. Note that this is actually a + multi-target recipe that includes any builder name supported by + ``Sphinx `_. + Only ``html`` has guaranteed support, but currently implemented are: + + - ``html`` + - ``dirhtml`` + - ``singlehtml`` + - ``epub`` + - ``latex`` + - ``man`` + - ``htmlhelp`` + - ``qthelp`` + - ``devhelp`` + - ``applehelp`` + - ``texinfo`` + - ``text`` + - ``gettext`` + - ``doctest`` + - ``linkcheck`` + - ``xml`` + - ``pseudoxml`` + .. make:target:: cs% + Recipes with this prefix are redirected to the C# directory. Please see language-specific documentation for more details. + .. make:target:: c% + Recipes with this prefix are redirected to the C directory. Please see language-specific documentation for more details. + .. make:target:: js% + Recipes with this prefix are redirected to the JavaScript directory. Please see language-specific documentation for more details. + .. make:target:: py% + Recipes with this prefix are redirected to the Python directory. Please see language-specific documentation for more details. + .. make:target:: rs% + Recipes with this prefix are redirected to the Rust directory. Please see language-specific documentation for more details. + .. make:target:: % + If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, + ``make test`` would be translated to ``make cstest ctest jstest pytest rstest`` + .. toctree:: :maxdepth: 2 From 10b44343f760113c63be7081232eea120c8272a4 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 23:21:09 -0500 Subject: [PATCH 150/326] link syntax --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index a30352ae..b6ee6883 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,7 +31,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi This recipe redirects to the docs Makefile. Note that this is actually a multi-target recipe that includes any builder name supported by - ``Sphinx `_. + `Sphinx `__. Only ``html`` has guaranteed support, but currently implemented are: - ``html`` From da8659e1a8d267973936f1ed0090d23ac5d1a983 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 23:27:09 -0500 Subject: [PATCH 151/326] More makefile docs --- docs/rust.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/rust.rst b/docs/rust.rst index c9923cf8..2d2b50b4 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -5,6 +5,31 @@ Euler Rust Implementation :start-line: 2 :end-before: Problems Solved +Usage +----- + +.. highlight:: make + +This folder contains a Makefile with several recipes, most of which are aliases to ``cargo`` commands. +This facilitates the root Makefile dispatching tasks to each language, many of which have more complex +build or test processes. + +.. make:target:: test + + Alias for ``cargo test``. + +.. make:target:: test_auto + + Runs tests in parallel with one less thread than you have CPUs. Alias for ``cargo test -j``. + +.. make:target:: test_% + + Runs tests in parallel with the specified number of threads. Alias for ``cargo test -j $*``. + +.. make:target:: clean + + Alias for ``cargo clean``. + Problems Solved --------------- From 0e569a4a1c2bea0daf9727e42568fb0f5400cc9f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 23:31:18 -0500 Subject: [PATCH 152/326] don't include readme makefile section --- docs/rust.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/rust.rst b/docs/rust.rst index 2d2b50b4..8c1b9a14 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -3,6 +3,10 @@ Euler Rust Implementation .. include:: ../rust/README.rst :start-line: 2 + :end-before: Makefile + +.. include:: ../rust/README.rst + :start-before: Tests :end-before: Problems Solved Usage From cd5661cc28f680891c6f0299a5b38be345a3ab77 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 4 Jul 2024 23:47:15 -0500 Subject: [PATCH 153/326] try different include parameters --- docs/rust.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rust.rst b/docs/rust.rst index 8c1b9a14..4bd7d9b4 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -6,7 +6,7 @@ Euler Rust Implementation :end-before: Makefile .. include:: ../rust/README.rst - :start-before: Tests + :start-after: Alias for ``cargo clean`` :end-before: Problems Solved Usage From 12700b023c78953db55a0cd8ef8add9af73a48d4 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 02:13:53 -0500 Subject: [PATCH 154/326] Update Makefile prefix system, more docs --- Makefile | 30 ++++++++++++++++-------------- c/Makefile | 3 +++ csharp/Makefile | 5 ++++- docs/Makefile | 3 +++ docs/csharp.rst | 41 +++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 14 +++++++++----- javascript/Makefile | 5 ++++- python/Makefile | 3 +++ rust/Makefile | 2 +- 9 files changed, 84 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 558fc273..113b0dea 100644 --- a/Makefile +++ b/Makefile @@ -2,25 +2,27 @@ PY?=python3 PROXY?= html dirhtml singlehtml htmlhelp qthelp devhelp epub applehelp latex man texinfo text gettext doctest linkcheck xml pseudoxml: - cd docs && $(MAKE) $@ $(MFLAGS) + @$(MAKE) docs_$@ $(MFLAGS) -clean: rsclean - rm -r docs/_build {c,python}/{*,*/*}.pyc csharp/*/{bin,obj,TestResults} javascript/node_modules || echo done +clean: cs_clean c_clean js_clean py_clean rs_clean docs_clean -py%: - cd python && $(MAKE) $* $(MFLAGS) +cs_%: + @cd csharp && $(MAKE) $* $(MFLAGS) -cs%: - cd csharp && $(MAKE) $* $(MFLAGS) +c_%: + @cd c && $(MAKE) $* $(MFLAGS) -c%: - cd c && $(MAKE) $* $(MFLAGS) +docs_%: + @cd docs && $(MAKE) $* $(MFLAGS) -js%: - cd javascript && $(MAKE) $* $(MFLAGS) +js_%: + @cd javascript && $(MAKE) $* $(MFLAGS) -rs%: - cd rust && $(MAKE) $* $(MFLAGS) +py_%: + @cd python && $(MAKE) $* $(MFLAGS) + +rs_%: + @cd rust && $(MAKE) $* $(MFLAGS) %: - $(MAKE) c$* cs$* js$* py$* rs$* $(MFLAGS) + @$(MAKE) c_$* cs_$* js_$* py_$* rs_$* $(MFLAGS) diff --git a/c/Makefile b/c/Makefile index d3b3d784..f7f0cc99 100644 --- a/c/Makefile +++ b/c/Makefile @@ -33,3 +33,6 @@ lint: native: $(CC) test.c Unity/src/unity.c -O2 -lm -Wall -Werror -std=c11 -march=native -flto -DAMD_COMPILER=0 + +clean: + rm -r build ./{*,*/*}{.pyc,__pycache__,.mypy_cache} || echo diff --git a/csharp/Makefile b/csharp/Makefile index 13d5f358..6afad577 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,3 +1,6 @@ +clean: + dotnet clean || rm ./*/{bin,obj,TestResults} || echo + test: dependencies dotnet test --nologo @@ -8,4 +11,4 @@ dependencies: dotnet restore lint: - dotnet format --verify-no-changes \ No newline at end of file + dotnet format --verify-no-changes diff --git a/docs/Makefile b/docs/Makefile index 88507ce3..5d7ad8cf 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -26,6 +26,9 @@ help: .PHONY: help Makefile +clean: + rm -r _build || echo + dependencies: $(PIP) install -r requirements.txt -r ../c/requirements.txt -r ../python/requirements.txt --upgrade $(USER_FLAG) $(PROXY_ARG) npm install -g jsdoc diff --git a/docs/csharp.rst b/docs/csharp.rst index 425bc7b9..dd7db365 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -3,8 +3,49 @@ Euler C# Implementation .. include:: ../csharp/README.rst :start-line: 2 + :end-before: Makefile + +.. include:: ../rust/README.rst + :start-after: Alias for ``cargo clean`` :end-before: Problems Solved +Usage +----- + +.. highlight:: make + +This folder contains a Makefile with several recipes> +This facilitates the root Makefile dispatching tasks> +build or test processes. + +.. make:target:: test + + Alias for ``dotnet test``. + +.. make:target:: test_auto + + .. note:: + + WIP + + Runs tests in parallel with one less thread than you have CPUs. Alias for ``dotnet test ``. + +.. make:target:: test_% + + .. note:: + + WIP + + Runs tests in parallel with the specified number of threads. Alias for ``dotnet test `. + +.. make:target:: clean + + Alias for ``dotnet clean``, with some degree of fallback if ``dotnet`` is not installed. + +.. make:target:: lint + + Alias for ``dotnet format --verify-no-changes``. + Test Infrastructure ------------------- diff --git a/docs/index.rst b/docs/index.rst index b6ee6883..5ba50cee 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -52,23 +52,27 @@ This project is divided into several Makefiles, connected by a root Makefile whi - ``xml`` - ``pseudoxml`` -.. make:target:: cs% +.. make:target:: cs_% Recipes with this prefix are redirected to the C# directory. Please see language-specific documentation for more details. -.. make:target:: c% +.. make:target:: c_% Recipes with this prefix are redirected to the C directory. Please see language-specific documentation for more details. -.. make:target:: js% +.. make:target:: docs_% + + Recipes with this prefix are redirected to the docs directory. + +.. make:target:: js_% Recipes with this prefix are redirected to the JavaScript directory. Please see language-specific documentation for more details. -.. make:target:: py% +.. make:target:: py_% Recipes with this prefix are redirected to the Python directory. Please see language-specific documentation for more details. -.. make:target:: rs% +.. make:target:: rs_% Recipes with this prefix are redirected to the Rust directory. Please see language-specific documentation for more details. diff --git a/javascript/Makefile b/javascript/Makefile index 5c8e628a..f5a3a22a 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -42,4 +42,7 @@ _dependencies: endif lint: - npx eslint *.js \ No newline at end of file + npx eslint *.js + +clean: + rm -r node_modules || echo diff --git a/python/Makefile b/python/Makefile index 7696be36..99b2f4a1 100644 --- a/python/Makefile +++ b/python/Makefile @@ -48,3 +48,6 @@ dependencies: cat requirements.txt | grep -v "mypy" > .requirements.txt $(PIP) install -r .requirements.txt $(USER_FLAG) $(PROXY_ARG) endif + +clean: + rm -r ./{*,*/*}{.pyc,__pycache__,.mypy_cache} || echo diff --git a/rust/Makefile b/rust/Makefile index 8e60aacb..2f7f3ce4 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -8,4 +8,4 @@ test_%: cargo test -j $* clean: - cargo clean + cargo clean || echo From 570374ee00c38189acdca790d75c4caf0e17ea03 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 02:17:29 -0500 Subject: [PATCH 155/326] Update workflows to new Makefile prefixes --- .github/workflows/c.yml | 8 ++++---- .github/workflows/csharp.yml | 4 ++-- .github/workflows/javascript.yml | 6 +++--- .github/workflows/python.yml | 4 ++-- .github/workflows/rust.yml | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 7a768882..678858c9 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -26,7 +26,7 @@ jobs: version: 1.0 - name: Run tests - run: make clint + run: make c_lint c: strategy: @@ -75,15 +75,15 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make ctest${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} + run: make c_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} - run: make ctest_auto + run: make c_test_auto - name: Run tests (macos) if: ${{ contains(matrix.os, 'macos') }} - run: make ctest_auto + run: make c_test_auto env: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 547b41c8..8cc4ad6a 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -39,7 +39,7 @@ jobs: run: make csdependencies - name: Run Tests - run: make cstest + run: make cs_test csharp-lint: runs-on: ubuntu-latest @@ -54,5 +54,5 @@ jobs: cache-dependency-path: 'csharp/*/packages.lock.json' - name: Run Linter - run: make cslint + run: make cs_lint diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 8f794a88..99b780f7 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -46,13 +46,13 @@ jobs: cache-dependency-path: 'javascript/package-lock.json' - name: Install dependencies - run: make jsdependencies + run: make js_dependencies - name: Run tests (serially) if: ${{ matrix.version == 22 && matrix.os == 'ubuntu-latest' }} - run: make jstest + run: make js_test - name: Run tests (in parallel) if: ${{ !(matrix.version == 22 && matrix.os == 'ubuntu-latest') }} - run: make jstest_auto + run: make js_test_auto diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 2f45a6a5..8b895294 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -72,8 +72,8 @@ jobs: - name: Run tests (serially) if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} - run: make pytest LINT=false + run: make py_test LINT=false - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} - run: make pytest_auto LINT=false + run: make py_test_auto LINT=false diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 99977405..4ba3fbd4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,4 +53,4 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} - - run: make rstest + - run: make rs_test From 414edc423b237f2148aaeb6333f3207bc57c9492 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 02:19:38 -0500 Subject: [PATCH 156/326] Update to new prefix system [no ci] --- README.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index d9e54978..83f88c33 100644 --- a/README.rst +++ b/README.rst @@ -68,11 +68,12 @@ If you are working on Project Euler problems, DO NOT use this as a source The repo is divided into sections for each language. The top-level Makefile will direct recipes using prefixes -- ``make c*`` will go to the c Makefile -- ``make cs*`` will go to the csharp Makefile -- ``make js*`` will go to the javascript Makefile -- ``make py*`` will go to the python Makefile -- ``make rs*`` will go to the rust Makefile +- ``make c_*`` will go to the c Makefile +- ``make cs_*`` will go to the csharp Makefile +- ``make docs_*`` will go to the docs Makefile +- ``make js_*`` will go to the javascript Makefile +- ``make py_*`` will go to the python Makefile +- ``make rs_*`` will go to the rust Makefile - Any make recipes supported by Sphinx will be redirected to the docs Makefile - All other recipes will be run for all languages From e73019a56f3e3a27725b233f116281b7df254202 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 02:21:57 -0500 Subject: [PATCH 157/326] fix a missed prefix --- .github/workflows/csharp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 8cc4ad6a..a33cde22 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -36,7 +36,7 @@ jobs: cache-dependency-path: 'csharp/*/packages.lock.json' - name: Dependencies - run: make csdependencies + run: make cs_dependencies - name: Run Tests run: make cs_test From b355d47f954a003593b47823dd5cf880b885eb90 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 10:29:05 -0500 Subject: [PATCH 158/326] Change to new prrefix --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1fcfe065..db3a9c5a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -86,7 +86,7 @@ jobs: - if: matrix.build-mode == 'manual' && matrix.language == 'c-cpp' shell: bash run: | - make cnative + make c_native - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From 2eff01f1895f1cef774b516b5ab45964cd2d2a94 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 12:35:24 -0500 Subject: [PATCH 159/326] try adding rust_crates --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 691b6a5b..be9cd75d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ hawkmoth_clang = ['-std=c11', '-DAMD_COMPILER=0'] hawkmoth_source_uri = 'https://github.com/LivInTheLookingGlass/Euler/blob/master/{source}#L{line}' js_source_path = basedir + os.sep + 'javascript' +rust_crates = ["../rust"] project = 'Euler' copyright = '2024, Olivia Appleton' From 063bb1f9d25ce1cbd117bcc5d8f070a286b9c9f0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 5 Jul 2024 22:37:06 -0500 Subject: [PATCH 160/326] More C documentation --- .github/workflows/pages.yml | 24 +++++----- docs/c.rst | 16 +++++++ docs/c/factors.rst | 30 +++++++++++++ docs/c/iterator.rst | 87 +++++++++++++++++++++++++++++++++++++ docs/c/p0001.rst | 7 ++- docs/conf.py | 4 -- docs/requirements.txt | 2 - 7 files changed, 150 insertions(+), 20 deletions(-) create mode 100644 docs/c/factors.rst create mode 100644 docs/c/iterator.rst diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 00356ecc..7d26b456 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,24 +11,28 @@ jobs: with: submodules: true - - name: Install system dependencies - uses: awalsh128/cache-apt-pkgs-action@latest + - name: Use Python 3.12 + uses: actions/setup-python@v5 with: - packages: python3-clang python3-pip libclang-dev clang - version: 1.0 + python-version: 3.12 + cache: 'pip' + cache-dependency-path: | + python/requirements.txt + c/requirements.txt + docs/requirements.txt - name: Use Node.js 22 uses: actions/setup-node@v3 with: node-version: 22 - - name: Use Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + # - name: Use Rust stable + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable - - name: Compile rust crate - run: cd docs && cargo build --manifest-path ../rust/Cargo.toml + # - name: Compile rust crate + # run: cd docs && cargo build --manifest-path ../rust/Cargo.toml - name: Build sphinx docs run: make html diff --git a/docs/c.rst b/docs/c.rst index b39a03b8..2d031a14 100644 --- a/docs/c.rst +++ b/docs/c.rst @@ -5,6 +5,22 @@ Euler C Implementation :start-line: 2 :end-before: Problems Solved +Library Code +------------ + +.. toctree:: + :glob: + :numbered: + :maxdepth: 1 + + c/bcd + c/digits + c/factors + c/iterator + c/macros + c/math + c/primes + Problems Solved --------------- diff --git a/docs/c/factors.rst b/docs/c/factors.rst new file mode 100644 index 00000000..b73e4c19 --- /dev/null +++ b/docs/c/factors.rst @@ -0,0 +1,30 @@ +factors.h +========= + +This file implements an :c:macro:`Iterator ` that yields proper +factors for a given number. It is generally used by first calling +:c:func:`proper_divisor_count` and the :c:macro:`next`/:c:macro:`next_p` functions. + +.. c:namespace-push:: factors + +.. c:type:: factor_counter + + .. c:member:: uintmax_t (*iterator_function)(factor_counter *it) + + .. c:member:: bool exhausted : 1 + + .. c:member:: bool started : 1 + + .. c:member:: bool phase : 1 + + .. c:member:: uintmax_t target + + .. c:member:: uintmax_t current + + .. c:function:: uintmax_t advance_factor_counter(factor_counter *fc) + + .. c:function:: factor_counter proper_divisors(uintmax_t target) + + .. c:function:: uintmax_t proper_divisor_count(uintmax_t target) + +.. c:namespace-pop:: diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst new file mode 100644 index 00000000..7e9281d7 --- /dev/null +++ b/docs/c/iterator.rst @@ -0,0 +1,87 @@ +iterator.h +========== + +.. c:namespace-push:: iterator + +.. c:macro:: IteratorHead(return_type, struct_type) + + This macro allows a struct to implement my Iterator API, which is + heavily inspired by Python. You should put it at the top of a struct + like so: + + .. code-block:: C + + struct counter { + IteratorHead(uintmax_t, counter); + uintmax_t idx; + uintmax_t stop; + intmax_t step; + }; + + It imparts the following internal properties. + + .. c:member:: return_type (*iterator_function)(struct_type *it) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the interator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves. + +.. c:macro:: IteratotionHead(it) + + This macro implements the base functionality of all :c:macro:`Iterator ` functions. + It must be at the top of all iteration functions, with the iterator passed + as an argument. + +.. c:macro:: IteratorInitHead(it, advance) + + This macro implements the library-managed portion of iterator construction. + The first argument should be the uninitialized iterator, and the second + argument should be a pointer to its iteration function. + +.. c:macro:: next(state) +.. c:macro:: next_p(state) + + These macros implement the iteration operation. The only difference between + them is that :c:macro:`next` takes in a struct and + :c:macro:`next_p` takes a pointer. Both yield `return_type`. + +.. c:type:: counter + + This is an example implementation of the :c:macro:`Iterator ` + API used in this project. You can construct it using any of the factory + functions found below, and it is generally used much like Python's + :py:ref:`range` object. + + .. c:member:: uintmax_t (*iterator_function)(counter *it) + + .. c:member:: bool exhausted : 1 + + .. c:member:: bool started : 1 + + .. c:member:: bool phase : 1 + + .. c:member:: uintmax_t idx + + .. c:member:: uintmax_t stop + + .. c:member:: intmax_t step + + .. c:function:: uintmax_t iterate_counter(counter *i) + + .. c:function:: counter counter3(uintmax_t start, uintmax_t stop, intmax_t step) + + .. c:function:: counter counter2(uintmax_t start, uintmax_t stop) + + .. c:function:: counter counter1(uintmax_t stop) + +.. c:namespace-pop:: diff --git a/docs/c/p0001.rst b/docs/c/p0001.rst index 7c4665ae..bfe7bf3d 100644 --- a/docs/c/p0001.rst +++ b/docs/c/p0001.rst @@ -3,11 +3,10 @@ C Implementation of Problem 1 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 1 - :file: p0001.c +Includes +-------- -.. c:autodoc:: p0001.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `iterator.h <./iterator.html>`__ .. literalinclude:: ../../c/p0001.c :language: C diff --git a/docs/conf.py b/docs/conf.py index be9cd75d..52faad64 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,9 +11,6 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.insert(0, basedir) sys.path.insert(0, basedir + os.sep + 'python') -hawkmoth_root = basedir + os.sep + 'c' -hawkmoth_clang = ['-std=c11', '-DAMD_COMPILER=0'] -hawkmoth_source_uri = 'https://github.com/LivInTheLookingGlass/Euler/blob/master/{source}#L{line}' js_source_path = basedir + os.sep + 'javascript' rust_crates = ["../rust"] @@ -40,7 +37,6 @@ 'sphinxcontrib.makedomain', ] if 'TERMUX_VERSION' not in os.environ: - # extensions.append('hawkmoth') extensions.append('sphinx_js') extensions.append('sphinx_rust') diff --git a/docs/requirements.txt b/docs/requirements.txt index 6499f65a..51d9cf5e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,8 +1,6 @@ sphinx>=3.1 sphinx-rtd-theme sphinx-js -hawkmoth -clang==14 sphinx-csharp sphinxcontrib-makedomain sphinx_rust From 3603ec33d2569e2eaaae5b6009d00d228a8011c4 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 18:18:54 -0500 Subject: [PATCH 161/326] Remove outdated termux fix --- javascript/Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/javascript/Makefile b/javascript/Makefile index f5a3a22a..148bb2a9 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -33,13 +33,7 @@ else # has NPM dependencies: _dependencies endif -ifneq ($(NOT_TERMUX),0) _dependencies: - npm install; -else -_dependencies: - npm install -g; -endif lint: npx eslint *.js From 7b88b02ebac13a2ad695d9691ec4cbcb6a316659 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 18:21:21 -0500 Subject: [PATCH 162/326] Fix mypy linting, add coverage plugin --- python/Makefile | 5 +++++ python/__init__.py | 0 python/p0000_template.py | 4 ++-- python/p0001.py | 2 +- python/p0002.py | 2 +- python/p0003.py | 2 +- python/p0004.py | 6 +++--- python/p0006.py | 2 +- python/p0007.py | 2 +- python/p0013.py | 2 +- python/p0015.py | 6 +++--- python/p0018.py | 2 +- python/p0019.py | 11 ++++++----- python/p0027.py | 2 +- python/p0029.py | 2 +- python/p0030.py | 2 +- python/p0039.py | 2 +- python/p0040.py | 3 ++- python/p0042.py | 2 +- python/p0043.py | 2 +- python/p0045.py | 8 ++++---- python/p0046.py | 3 ++- python/p0048.py | 2 +- python/p0052.py | 3 ++- python/p0053.py | 2 +- python/p0055.py | 2 +- python/p0056.py | 2 +- python/p0067.py | 2 +- python/p0134.py | 2 +- python/requirements.txt | 1 + python/test_euler.py | 12 ++++++------ 31 files changed, 55 insertions(+), 45 deletions(-) delete mode 100644 python/__init__.py diff --git a/python/Makefile b/python/Makefile index 99b2f4a1..c7662f2b 100644 --- a/python/Makefile +++ b/python/Makefile @@ -3,6 +3,7 @@ PY?=python3 USER_FLAG?=--user PIP?=$(PY) -m pip MYPY?=true +COV?=false ifneq ($(MYPY),true) LINT=less @@ -22,6 +23,10 @@ endif endif endif +ifeq ($(COV),true) +pytest_args+= --cov +endif + ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) else diff --git a/python/__init__.py b/python/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/python/p0000_template.py b/python/p0000_template.py index fff146cf..58dcd03b 100644 --- a/python/p0000_template.py +++ b/python/p0000_template.py @@ -9,8 +9,8 @@ """ -def main(): - pass +def main() -> int: + return 0 if __name__ == '__main__': diff --git a/python/p0001.py b/python/p0001.py index 99b754f6..b2ccc316 100644 --- a/python/p0001.py +++ b/python/p0001.py @@ -23,7 +23,7 @@ def summation(up_to: int, factor: int) -> int: return (n + 1) * factor * n // 2 -def main(): +def main() -> int: return summation(999, 3) + summation(999, 5) - summation(999, 15) diff --git a/python/p0002.py b/python/p0002.py index 718ff096..b4a90da6 100644 --- a/python/p0002.py +++ b/python/p0002.py @@ -62,7 +62,7 @@ def fib_by_3(start_index: int = 0) -> Iterator[int]: a, b = b, a + b * 4 -def main(): +def main() -> int: f = fib_by_3() # this works because every third value is even answer = val = 0 while val < 4_000_000: diff --git a/python/p0003.py b/python/p0003.py index 51079cf7..1318c500 100644 --- a/python/p0003.py +++ b/python/p0003.py @@ -95,7 +95,7 @@ def modified_eratosthenes() -> Iterator[int]: sieve[candidate] = step -def prime_factors(num) -> Iterator[int]: +def prime_factors(num: int) -> Iterator[int]: if num < 0: yield -1 num = -num diff --git a/python/p0004.py b/python/p0004.py index 3a468929..8d8f1c04 100644 --- a/python/p0004.py +++ b/python/p0004.py @@ -18,16 +18,16 @@ """ from itertools import combinations -from typing import Callable +from typing import Any, Callable -def is_palindrome(n, rep_func: Callable[[int], str] = repr): +def is_palindrome(n: Any, rep_func: Callable[[Any], str] = repr) -> bool: """Checks if the string representation of an object is a palindrome""" r = rep_func(n) return r == r[::-1] -def main(): +def main() -> int: result = 0 for x, y in combinations(range(100, 1000), 2): num = x * y diff --git a/python/p0006.py b/python/p0006.py index e444d568..cfe45aad 100644 --- a/python/p0006.py +++ b/python/p0006.py @@ -19,7 +19,7 @@ """ -def main(): +def main() -> int: group = range(1, 101) sum_of_squares = sum(x**2 for x in group) square_of_sum = sum(group)**2 diff --git a/python/p0007.py b/python/p0007.py index ad779685..5ecff154 100644 --- a/python/p0007.py +++ b/python/p0007.py @@ -61,7 +61,7 @@ def is_prime( seen_add: Callable[[Optional[int]], None] if distinct: seen = set() - seen_add = cast(Set[Optional[int]], seen).add + seen_add = seen.add else: seen = [] seen_add = seen.append diff --git a/python/p0013.py b/python/p0013.py index 8d8af1b6..8e4771f1 100644 --- a/python/p0013.py +++ b/python/p0013.py @@ -107,7 +107,7 @@ """ -def main(): +def main() -> int: numbers = ( 37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538, diff --git a/python/p0015.py b/python/p0015.py index 62920943..0e9ee671 100644 --- a/python/p0015.py +++ b/python/p0015.py @@ -18,15 +18,15 @@ from math import factorial -def n_choose_r(n, r): +def n_choose_r(n: int, r: int) -> int: return factorial(n) // factorial(r) // factorial(n - r) -def lattice_paths(height: int, width: int): +def lattice_paths(height: int, width: int) -> int: return n_choose_r(height + width, height) -def main(): +def main() -> int: return lattice_paths(20, 20) diff --git a/python/p0018.py b/python/p0018.py index 8b4431b2..22e73b8d 100644 --- a/python/p0018.py +++ b/python/p0018.py @@ -57,7 +57,7 @@ def reduce_triangle(triangle: Sequence[Sequence[int]]) -> int: return potential_totals[0] -def main(): +def main() -> int: rows = ( (75, ), (95, 64), diff --git a/python/p0019.py b/python/p0019.py index 71871196..91c7fdd6 100644 --- a/python/p0019.py +++ b/python/p0019.py @@ -22,14 +22,15 @@ (1 Jan 1901 to 31 Dec 2000)? """ from datetime import date +from typing import Iterable -def monthly_iterator(years, months=range(1, 13), day=1): - for x in range(1901, 2001): +def monthly_iterator(years: range, months: range = range(1, 13), day: int = 1) -> Iterable[date]: + for x in years: for y in range(1, 13): - day = date(x, y, 1) - if day.weekday() == 6: - yield day + _day = date(x, y, day) + if _day.weekday() == 6: + yield _day def main() -> int: diff --git a/python/p0027.py b/python/p0027.py index 03cd4438..d2b93de6 100644 --- a/python/p0027.py +++ b/python/p0027.py @@ -39,7 +39,7 @@ def quadratic(n: int, a: int, b: int) -> int: return (n + a) * n + b -def primes_and_negatives(*args) -> Iterator[int]: +def primes_and_negatives(*args: int) -> Iterator[int]: for p in primes(*args): yield p yield -p diff --git a/python/p0029.py b/python/p0029.py index 1189aa22..83bb83a1 100644 --- a/python/p0029.py +++ b/python/p0029.py @@ -22,7 +22,7 @@ """ -def main(): +def main() -> int: space = range(2, 101) return len(set(a**b for a in space for b in space)) diff --git a/python/p0030.py b/python/p0030.py index 6d763981..2704f6b0 100644 --- a/python/p0030.py +++ b/python/p0030.py @@ -22,7 +22,7 @@ """ -def main(): +def main() -> int: ret = 0 for x in range(2, 10**6): if x == sum(int(y)**5 for y in repr(x)): diff --git a/python/p0039.py b/python/p0039.py index 1c89ff25..46b19c0c 100644 --- a/python/p0039.py +++ b/python/p0039.py @@ -12,7 +12,7 @@ """ -def main(): +def main() -> int: biggest = 0 biggest_size = 0 for p in range(3, 1000): diff --git a/python/p0040.py b/python/p0040.py index 8c52df2b..faa363db 100644 --- a/python/p0040.py +++ b/python/p0040.py @@ -19,7 +19,7 @@ from operator import mul -def main(): +def main() -> int: digits_seen = 1 interests = {1, 10, 100, 1_000, 10_000, 100_000, 1_000_000} queries = [] @@ -32,6 +32,7 @@ def main(): print(queries) return reduce(mul, queries, 1) digits_seen += digits + return -1 if __name__ == '__main__': diff --git a/python/p0042.py b/python/p0042.py index 275c34cc..f649bb1e 100644 --- a/python/p0042.py +++ b/python/p0042.py @@ -34,7 +34,7 @@ def is_in_triangle(n: int) -> bool: return n in Cache.cache -def main(): +def main() -> int: answer = 0 with Path(__file__).parent.parent.joinpath('_data', 'p0042_words.txt').open('rb') as f: words = f.read().replace(b'"', b'').split(b',') diff --git a/python/p0043.py b/python/p0043.py index 185f9335..03a81b6c 100644 --- a/python/p0043.py +++ b/python/p0043.py @@ -30,7 +30,7 @@ from p0055 import from_digits -def main(): +def main() -> int: answer = 0 divisibility = (3, 5, 7, 11, 13, 17) for d in permutations(range(10), 10): diff --git a/python/p0045.py b/python/p0045.py index 00d2f839..8c873d7d 100644 --- a/python/p0045.py +++ b/python/p0045.py @@ -14,19 +14,19 @@ """ -def T(n): +def T(n: int) -> int: return n * (n + 1) // 2 -def P(n): +def P(n: int) -> int: return n * (3 * n - 1) // 2 -def H(n): +def H(n: int) -> int: return n * (2 * n - 1) -def main(): +def main() -> int: T_idx = 286 P_idx = 166 H_idx = 144 diff --git a/python/p0046.py b/python/p0046.py index 424ce7de..8bcd273e 100644 --- a/python/p0046.py +++ b/python/p0046.py @@ -30,7 +30,7 @@ from p0007 import is_prime -def main(): +def main() -> int: cached_primes = tuple(primes(6000)) for goal in count(35, 2): if is_prime(goal): @@ -45,6 +45,7 @@ def main(): break else: return goal + return -1 if __name__ == '__main__': diff --git a/python/p0048.py b/python/p0048.py index 066bde92..1006699f 100644 --- a/python/p0048.py +++ b/python/p0048.py @@ -9,7 +9,7 @@ """ -def main(): +def main() -> int: ten_ten = 10**10 return sum(pow(x, x, ten_ten) for x in range(1, 1001)) % ten_ten diff --git a/python/p0052.py b/python/p0052.py index 713a1758..a543c9b6 100644 --- a/python/p0052.py +++ b/python/p0052.py @@ -27,11 +27,12 @@ def digits(n: int) -> List[int]: return ret -def main(): +def main() -> int: for x in count(1): orig = set(digits(x)) if all(set(digits(x * y)) == orig for y in range(2, 7)): return x + return -1 if __name__ == '__main__': diff --git a/python/p0053.py b/python/p0053.py index 1f41d159..d05c03a1 100644 --- a/python/p0053.py +++ b/python/p0053.py @@ -27,7 +27,7 @@ from p0015 import n_choose_r -def main(): +def main() -> int: answer = 0 for n in range(101): for r in range(2, n-1): diff --git a/python/p0055.py b/python/p0055.py index 10aaaae2..28512343 100644 --- a/python/p0055.py +++ b/python/p0055.py @@ -50,7 +50,7 @@ def steps_to_palindrome(n: int, depth: int = 0) -> int: return steps_to_palindrome(new, depth=depth + 1) -def main(): +def main() -> int: answer = 0 for x in range(1, 10_000): if not steps_to_palindrome(x): diff --git a/python/p0056.py b/python/p0056.py index 45c07c5f..3246cfae 100644 --- a/python/p0056.py +++ b/python/p0056.py @@ -11,7 +11,7 @@ from p0074 import digits -def main(): +def main() -> int: answer = 0 for x in range(2, 100): for y in range(1, 100): diff --git a/python/p0067.py b/python/p0067.py index 3abd112d..33d44a70 100644 --- a/python/p0067.py +++ b/python/p0067.py @@ -29,7 +29,7 @@ from p0018 import reduce_triangle -def main(): +def main() -> int: rows = [] with Path(__file__).parent.parent.joinpath("_data", "p0067_triangle.txt").open("r") as f: for line in f.readlines(): diff --git a/python/p0134.py b/python/p0134.py index 35343fec..0023ff31 100644 --- a/python/p0134.py +++ b/python/p0134.py @@ -25,7 +25,7 @@ from p0003 import primes -def mul_inv(a: int, b: int): +def mul_inv(a: int, b: int) -> int: """Multiplicative inverse for modulo numbers""" if b == 1: return 1 diff --git a/python/requirements.txt b/python/requirements.txt index 50bb4abc..bb7e2301 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -5,3 +5,4 @@ pytest-benchmark pytest-mypy pytest-isort pytest-xdist +pytest-coverage diff --git a/python/test_euler.py b/python/test_euler.py index e593442f..35337c7d 100644 --- a/python/test_euler.py +++ b/python/test_euler.py @@ -3,7 +3,7 @@ from pathlib import Path from shutil import which from sys import path -from typing import Any, Callable, Union +from typing import Any, Callable, Iterable, Tuple, Union, cast from warnings import warn from pytest import fail, fixture, mark, skip, xfail @@ -120,13 +120,13 @@ @fixture(params=("{:0>3}".format(x) for x in sorted(answers.keys()))) # to make sure the benchmarks sort correctly -def key(request): # type: ignore +def key(request) -> int: # type: ignore return int(request.param) # reduce processing burden on test @mark.parametrize("group_size_str", ("{:0>2}".format(x) for x in range(2, 65))) def test_groupwise(benchmark: Any, group_size_str: str) -> None: - def test_func(): + def test_func() -> Iterable[Tuple[int, ...]]: return tuple(groupwise(range(10_000 + group_size), group_size)) if ONLY_SLOW or NO_OPTIONAL_TESTS: @@ -139,7 +139,7 @@ def test_func(): def test_is_prime(benchmark: Any) -> None: - def func(set_of_primes): + def func(set_of_primes: Iterable[int]) -> None: last = 2 for x, y in zip(primes(), set_of_primes): assert is_prime(x) @@ -160,7 +160,7 @@ def func(set_of_primes): def test_problem(benchmark: Any, key: int) -> None: if (NO_SLOW and key in known_slow) or (ONLY_SLOW and key not in known_slow): skip() - test_func: Callable[[], int] = __import__("p{:0>4}".format(key)).main # type: ignore + test_func: Callable[[], int] = __import__("p{:0>4}".format(key)).main if key in known_slow: answer = benchmark.pedantic(test_func, iterations=1, rounds=1) else: @@ -170,6 +170,6 @@ def test_problem(benchmark: Any, key: int) -> None: gc.collect() # sometimes benchmark disables itself, so check for .stats if hasattr(benchmark, 'stats') and benchmark.stats.stats.median > 60: - fail_func = xfail if key in known_slow else fail + fail_func = cast(Callable[[str], None], xfail if key in known_slow else fail) stats = benchmark.stats.stats fail_func("Exceeding 60s! (Max={:.6}s, Median={:.6}s)".format(stats.max, stats.median)) From b462934a11021c5088b829091a99dd5eb6382ab8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 18:42:46 -0500 Subject: [PATCH 163/326] Add coverage support --- javascript/Makefile | 17 +- javascript/package-lock.json | 540 ++++++++++++++++++++++++++--------- javascript/package.json | 3 +- 3 files changed, 416 insertions(+), 144 deletions(-) diff --git a/javascript/Makefile b/javascript/Makefile index 148bb2a9..3dd7e0eb 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -1,14 +1,21 @@ NOT_TERMUX?=$(shell command -v termux-setup-storage > /dev/null 2>&1 ; echo $$?) HAS_NPM?=$(shell command -v npm > /dev/null 2>&1 ; echo $$?) +COV?=false + +ifeq ($(COV),true) +MOCHA=istanbul cover ./node_modules/mocha/bin/_mocha +else +MOCHA=npx mocha +endif test: dependencies - npx mocha + $(MOCHA) test_auto: dependencies - npx mocha --parallel + $(MOCHA) --parallel test_%: dependencies - npx mocha -parallel -j $* + $(MOCHA) --parallel -j $* ifneq ($(HAS_NPM),0) ifeq ($(OS),Windows_NT) # if no NPM and Windows @@ -34,6 +41,10 @@ dependencies: _dependencies endif _dependencies: +ifeq ($(COV),true) + npm install -g istanbul +endif + npm install lint: npx eslint *.js diff --git a/javascript/package-lock.json b/javascript/package-lock.json index bab7af15..1c2a8949 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -10,7 +10,8 @@ "license": "ISC", "dependencies": { "benchmark": "^2.1.4", - "mocha": "^10.5.1" + "istanbul": "^0.4.5", + "mocha": "^10.6.0" }, "devDependencies": { "@eslint/eslintrc": "^3.1.0", @@ -21,23 +22,43 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@eslint/eslintrc": { @@ -81,23 +102,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/@eslint/eslintrc/node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, "node_modules/@eslint/eslintrc/node_modules/eslint-visitor-keys": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", @@ -160,12 +164,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@eslint/eslintrc/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/@eslint/js": { "version": "9.5.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.5.0.tgz", @@ -175,6 +173,12 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==", + "license": "ISC" + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -218,10 +222,21 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", + "license": "BSD-3-Clause OR MIT", + "optional": true, + "engines": { + "node": ">=0.4.2" + } + }, "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "license": "MIT", "engines": { "node": ">=6" } @@ -260,6 +275,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -272,7 +288,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -286,6 +301,12 @@ "node": ">=4" } }, + "node_modules/async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==", + "license": "MIT" + }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -304,6 +325,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", "engines": { "node": ">=8" }, @@ -315,7 +337,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -325,6 +346,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -335,7 +357,8 @@ "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "license": "ISC" }, "node_modules/callsites": { "version": "3.1.0", @@ -350,6 +373,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -393,6 +417,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -434,6 +459,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -444,6 +470,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -451,12 +478,14 @@ "node_modules/cliui/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/cliui/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } @@ -465,6 +494,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -478,6 +508,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -503,8 +534,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "node_modules/cross-spawn": { "version": "6.0.5", @@ -523,9 +553,10 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "license": "MIT", "dependencies": { "ms": "2.1.2" }, @@ -547,6 +578,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -557,13 +589,13 @@ "node_modules/deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } @@ -603,6 +635,49 @@ "node": ">=0.8.0" } }, + "node_modules/escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A==", + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=0.12.0" + }, + "optionalDependencies": { + "source-map": "~0.2.0" + } + }, + "node_modules/escodegen/node_modules/esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/escodegen/node_modules/estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz", @@ -709,23 +784,6 @@ "node": ">=6" } }, - "node_modules/eslint/node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, "node_modules/eslint/node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -735,12 +793,6 @@ "node": ">=4" } }, - "node_modules/eslint/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/eslint/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -780,7 +832,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -826,7 +877,6 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -854,8 +904,7 @@ "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "node_modules/figures": { "version": "2.0.0", @@ -885,6 +934,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -896,6 +946,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "license": "MIT", "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -911,6 +962,7 @@ "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } @@ -945,6 +997,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -968,21 +1021,25 @@ } }, "node_modules/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -1008,6 +1065,36 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -1021,6 +1108,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "license": "MIT", "bin": { "he": "bin/he" } @@ -1135,6 +1223,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, @@ -1174,6 +1263,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -1182,6 +1272,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1196,6 +1287,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -1206,20 +1298,96 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha512-nMtdn4hvK0HjUlzr1DrKSUY8ychprt8dzHOgY2KXsIhHu5PuQQEOTM27gV9Xblyon7aUH/TSFIjRHEODF/FRPg==", + "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", + "license": "BSD-3-Clause", + "dependencies": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/istanbul/node_modules/esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul/node_modules/glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/istanbul/node_modules/has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul/node_modules/supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==", + "license": "MIT", + "dependencies": { + "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" + } }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -1244,7 +1412,6 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -1257,6 +1424,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "license": "MIT", "dependencies": { "p-locate": "^5.0.0" }, @@ -1276,6 +1444,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -1291,6 +1460,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1305,6 +1475,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1320,6 +1491,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1330,12 +1502,14 @@ "node_modules/log-symbols/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/log-symbols/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1344,6 +1518,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -1355,7 +1530,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1367,7 +1541,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1377,7 +1550,6 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, "dependencies": { "minimist": "^1.2.5" }, @@ -1386,30 +1558,31 @@ } }, "node_modules/mocha": { - "version": "10.5.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.5.1.tgz", - "integrity": "sha512-eq5tEnaz2kM9ade8cuGJBMh5fBb9Ih/TB+ddlmPR+wLQmwLhUwa0ovqDlg7OTfKquW0BI7NUcNWX7DH8sC+3gw==", + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.6.0.tgz", + "integrity": "sha512-hxjt4+EEB0SA0ZDygSS015t65lJw/I2yRCS3Ae+SJ5FrbzrXgfYwJr96f0OvIXdj7h4lv/vLCrH3rkiuizFSvw==", + "license": "MIT", "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", "chokidar": "^3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "8.1.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" }, "bin": { "_mocha": "bin/_mocha", @@ -1422,12 +1595,14 @@ "node_modules/mocha/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" }, "node_modules/mocha/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -1436,6 +1611,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -1448,6 +1624,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1466,6 +1643,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -1474,9 +1652,10 @@ } }, "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -1487,7 +1666,8 @@ "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/mute-stream": { "version": "0.0.7", @@ -1501,16 +1681,35 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -1548,7 +1747,6 @@ "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.4", @@ -1574,6 +1772,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -1588,6 +1787,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "license": "MIT", "dependencies": { "p-limit": "^3.0.2" }, @@ -1622,7 +1822,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -1636,10 +1835,18 @@ "node": ">=4" } }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true, + "license": "ISC" + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -1656,7 +1863,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true, "engines": { "node": ">= 0.8.0" } @@ -1683,6 +1889,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } @@ -1691,6 +1898,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, @@ -1715,6 +1923,12 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==", + "license": "MIT" + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -1791,7 +2005,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -1809,9 +2024,10 @@ } }, "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } @@ -1857,11 +2073,22 @@ "node": ">=6" } }, + "node_modules/source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA==", + "optional": true, + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "node_modules/string-width": { "version": "2.1.1", @@ -1903,6 +2130,7 @@ "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -1917,6 +2145,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1999,6 +2228,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -2016,7 +2246,6 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, "dependencies": { "prelude-ls": "~1.1.2" }, @@ -2024,6 +2253,19 @@ "node": ">= 0.8.0" } }, + "node_modules/uglify-js": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.18.0.tgz", + "integrity": "sha512-SyVVbcNBCk0dzr9XL/R/ySrmYf0s372K6/hFklzgcp2lBFyXtw4I7BOdDjlLhE1aVqaI/SHWXWmYdlZxuyF38A==", + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -2043,7 +2285,6 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -2054,18 +2295,19 @@ "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==" + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", + "license": "Apache-2.0" }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -2082,6 +2324,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -2090,6 +2333,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -2104,6 +2348,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -2114,17 +2359,20 @@ "node_modules/wrap-ansi/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/wrap-ansi/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } @@ -2133,6 +2381,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2146,6 +2395,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -2174,6 +2424,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", "engines": { "node": ">=10" } @@ -2182,6 +2433,7 @@ "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "license": "MIT", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -2196,9 +2448,10 @@ } }, "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "license": "ISC", "engines": { "node": ">=10" } @@ -2207,6 +2460,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "license": "MIT", "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", @@ -2221,6 +2475,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -2228,12 +2483,14 @@ "node_modules/yargs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/yargs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } @@ -2242,6 +2499,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2255,6 +2513,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -2266,6 +2525,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "license": "MIT", "engines": { "node": ">=10" }, diff --git a/javascript/package.json b/javascript/package.json index 2381184e..80a03513 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -10,7 +10,8 @@ "license": "ISC", "dependencies": { "benchmark": "^2.1.4", - "mocha": "^10.5.1" + "istanbul": "^0.4.5", + "mocha": "^10.6.0" }, "devDependencies": { "@eslint/eslintrc": "^3.1.0", From 91a2e1c9c96fce8f2a05f0c723da1676a68961d8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 18:57:10 -0500 Subject: [PATCH 164/326] Addvdoverage reporting --- .github/workflows/c.yml | 4 ++++ .github/workflows/javascript.yml | 8 ++++++-- .github/workflows/python.yml | 9 +++++++-- .github/workflows/rust.yml | 20 +++++++++++++++++++- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 678858c9..b4a24c0b 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -88,3 +88,7 @@ jobs: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 99b780f7..c7fd9a0a 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -50,9 +50,13 @@ jobs: - name: Run tests (serially) if: ${{ matrix.version == 22 && matrix.os == 'ubuntu-latest' }} - run: make js_test + run: make js_test COV=true - name: Run tests (in parallel) if: ${{ !(matrix.version == 22 && matrix.os == 'ubuntu-latest') }} - run: make js_test_auto + run: make js_test_auto COV=true + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8b895294..3341989b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -72,8 +72,13 @@ jobs: - name: Run tests (serially) if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} - run: make py_test LINT=false + run: make py_test LINT=true COV=true - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} - run: make py_test_auto LINT=false + run: make py_test_auto LINT=false COV=true + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4ba3fbd4..d1395f88 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,7 +50,25 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} - - run: make rs_test + + - run: cd rust && cargo build + + - run: cd rust && cargo test + env: + CARGO_INCREMENTAL: '0' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + + - name: rust-grcov + # You may pin to the exact commit or the version. + # uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248 + uses: actions-rs/grcov@v0.1 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} From c51e249c913616267ceca8845f1a57ff90805f37 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 18:58:35 -0500 Subject: [PATCH 165/326] fix rust syntax --- .github/workflows/rust.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d1395f88..4efd92fb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -63,12 +63,10 @@ jobs: RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' - - name: rust-grcov - # You may pin to the exact commit or the version. - # uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248 - uses: actions-rs/grcov@v0.1 + - name: rust-grcov + uses: actions-rs/grcov@v0.1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 27bcaa2fa9f4d2957e59eea7e8f8b48db7ebc142 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 19:01:48 -0500 Subject: [PATCH 166/326] make sure it tests AND lints --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 3341989b..20592c86 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -72,7 +72,7 @@ jobs: - name: Run tests (serially) if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} - run: make py_test LINT=true COV=true + run: make py_test COV=true - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} From 0c672b376c6d0b911befafbe0c4a1ea3481c6fdd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 19:09:09 -0500 Subject: [PATCH 167/326] try adding coverage --- python/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/python/requirements.txt b/python/requirements.txt index bb7e2301..71990b35 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -6,3 +6,4 @@ pytest-mypy pytest-isort pytest-xdist pytest-coverage +coverage From 5b6955bb061d8940c96649ad2ef925db64f27092 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 19:09:30 -0500 Subject: [PATCH 168/326] add coverage hooks --- c/Makefile | 4 ++-- c/test_euler.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c/Makefile b/c/Makefile index f7f0cc99..76064a60 100644 --- a/c/Makefile +++ b/c/Makefile @@ -14,10 +14,10 @@ endif test_%: dependencies cd ../python; $(MAKE) dependencies $(MFLAGS) - $(PY) -m pytest -vl -n$* test_euler.py + $(PY) -m pytest -vl -n$* test_euler.py --cov test: dependencies - $(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py + $(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py --cov dependencies: git submodule init diff --git a/c/test_euler.py b/c/test_euler.py index 32fb0545..193116fc 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -149,7 +149,7 @@ EXE_TEMPLATE = "{}{}p{{:0>4}}.{{}}.{}".format(BUILD_FOLDER, sep, EXE_EXT) # include sep in the recipe so that Windows won't complain -GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std=c11 -march=native -flto -fwhole-program -o {{}}" +GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std=c11 -march=native -flto -fwhole-program -ftest-coverage -fprofile-arcs -o {{}}" CLANG_TEMPLATE = "{} {{}} -O2 {} {} -Wall -Werror -std=c11 {} -o {{}}" templates = { From e41e4beddc2e6343bf3fb59a51c875fed75d8c8c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 19:12:34 -0500 Subject: [PATCH 169/326] distinguish between nightly and rest --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4efd92fb..50053b5f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,6 +58,10 @@ jobs: - run: cd rust && cargo build - run: cd rust && cargo test + if: ${{ matrix.toolchain != 'nightly' }} + + - run: cd rust && cargo test + if: ${{ matrix.toolchain == 'nightly' }} env: CARGO_INCREMENTAL: '0' RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' From 3c090e6f008e47cfdd5adf43016e12578581487a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:05:15 -0500 Subject: [PATCH 170/326] add codecov.yaml --- codecov.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 codecov.yaml diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..f86007d7 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,28 @@ +component_management: + default_rules: # default rules that will be inherited by all components + statuses: + - type: project # in this case every component that doens't have a status defined will have a project type one + target: auto + branches: + - "!main" + individual_components: + - component_id: module_c # this is an identifier that should not be changed + name: C # this is a display name, and can be changed freely + paths: + - c/** + - component_id: module_csharp + name: C# + paths: + - csharp/** + - component_id: module_javascript + name: JavaScript + paths: + - javascript/** + - component_id: module_python + name: Python + paths: + - python/** + - component_id: module_rust + name: Rust + paths: + - rust/** From 838c6c7810c6c0b85dd2f8c005d6cf0bcca99f36 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:06:43 -0500 Subject: [PATCH 171/326] switch to shell expansion --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 113b0dea..cda6b6da 100644 --- a/Makefile +++ b/Makefile @@ -25,4 +25,4 @@ rs_%: @cd rust && $(MAKE) $* $(MFLAGS) %: - @$(MAKE) c_$* cs_$* js_$* py_$* rs_$* $(MFLAGS) + @$(MAKE) {c,cs,js,py,rs}_$* $(MFLAGS) From e9a4c50ffb4e4f4ace17c81487dcf3251b7a93d5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:09:08 -0500 Subject: [PATCH 172/326] install python deps --- c/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/Makefile b/c/Makefile index 76064a60..3bc84e75 100644 --- a/c/Makefile +++ b/c/Makefile @@ -22,7 +22,7 @@ test: dependencies dependencies: git submodule init git submodule update - $(PIP) install -r requirements.txt $(USER_FLAG) $(PROXY_ARG) + $(PIP) install -r requirements.txt -r ../python/requirements.txt $(USER_FLAG) $(PROXY_ARG) lint: if test -z "$(clang-tidy p0000_template.c -warnings-as-errors=* 2>&1 | grep "Unknown command line argument")"; then \ From 5cb8a08a3f9092c65dcf4ef37a81dde1373ae5eb Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:16:29 -0500 Subject: [PATCH 173/326] try different workflow for coverage --- .github/workflows/rust.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 50053b5f..5a303666 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -68,9 +68,11 @@ jobs: RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' - name: rust-grcov - uses: actions-rs/grcov@v0.1 + if: ${{ matrix.toolchain == 'nightly' }} + run: cargo install grcov && grcov -r rust - name: Upload coverage reports to Codecov + if: ${{ matrix.toolchain == 'nightly' }} uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 703a0b52edaa86dca2a09038eddf17f96733c931 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:25:02 -0500 Subject: [PATCH 174/326] add coverage details --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 83f88c33..4e44201a 100644 --- a/README.rst +++ b/README.rst @@ -19,6 +19,8 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml .. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml +.. |Coverage| image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graph/badge.svg?token=6GHBNILEHG + :target: https://codecov.io/github/LivInTheLookingGlass/Euler .. |br| raw:: html
@@ -44,6 +46,8 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ +| Code Coverage (in progress) | |Coverage| | ++-------------------------------------------------+---------------+ | Code Scanning | |CodeQL| |br| | | | |ESLint| |br| | | | |RustClippy| | @@ -59,6 +63,11 @@ All solutions are tested against multiple operating systems and language/compiler versions. For more information, see ``.github/workflows/`` +Coverage Graph +-------------- + +.. image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graphs/icicle.svg?token=6GHBNILEHG + This is NOT meant to help others on Project Euler problems ---------------------------------------------------------- From 4c2e5e592a23edacbf8afe065cc34b7d8cf6381b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:32:57 -0500 Subject: [PATCH 175/326] detect if coverage is wanted --- c/test_euler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c/test_euler.py b/c/test_euler.py index 193116fc..bd98e1df 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -149,7 +149,9 @@ EXE_TEMPLATE = "{}{}p{{:0>4}}.{{}}.{}".format(BUILD_FOLDER, sep, EXE_EXT) # include sep in the recipe so that Windows won't complain -GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std=c11 -march=native -flto -fwhole-program -ftest-coverage -fprofile-arcs -o {{}}" +GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std=c11 -march=native -flto -fwhole-program -o {{}}" +if environ.get('COV') == 'true': + GCC_TEMPLATE += ' -ftest-coverage -fprofile-arcs' CLANG_TEMPLATE = "{} {{}} -O2 {} {} -Wall -Werror -std=c11 {} -o {{}}" templates = { @@ -226,6 +228,8 @@ def test_deterministic_build(c_file, compiler): xfail() elif compiler == 'PCC' and c_file in PCC_no_reproducible: xfail() # PCC doesn't allow reproducible builds with static keyword + elif compiler == 'GCC' and environ.get('COV') == 'true': + xfail() # GCC doesn't do reproducible builds w/ code coverage raise From 6116274d0cea5d9060f91ba956b5c264f07c3dbf Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 6 Jul 2024 21:36:59 -0500 Subject: [PATCH 176/326] fail-fast --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5a303666..4818a880 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,6 +16,7 @@ jobs: name: Rust project - latest runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: toolchain: - stable From 4989929fee3e8564d88ef34ad3e7f9c55c9e55b8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:08:50 -0500 Subject: [PATCH 177/326] remove file filters, try to get C reporting up --- .github/workflows/c.yml | 10 +--------- .github/workflows/csharp.yml | 6 ------ .github/workflows/javascript.yml | 5 ----- .github/workflows/python.yml | 5 ----- .github/workflows/rust.yml | 5 ----- 5 files changed, 1 insertion(+), 30 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index b4a24c0b..99840400 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -2,14 +2,6 @@ name: C on: push: - paths: - - python/requirements.txt - - python/p0003.py - - python/p0007.py - - c/** - - Makefile - - _data/** - - .github/workflows/c.yml jobs: c-lint: @@ -75,7 +67,7 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make c_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} + run: make c_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} COV=true - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index a33cde22..c73a6968 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -2,12 +2,6 @@ name: C# on: push: - paths: - - csharp/** - - Euler.sln - - Makefile - - _data/** - - .github/workflows/csharp.yml jobs: csharp: diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index c7fd9a0a..7a05d1c1 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -2,11 +2,6 @@ name: JS on: push: - paths: - - javascript/** - - Makefile - - _data/** - - .github/workflows/javascript.yml jobs: javascript: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 20592c86..8f739ded 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,11 +2,6 @@ name: Py on: push: - paths: - - python/** - - Makefile - - _data/** - - .github/workflows/python.yml jobs: # python-lint: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4818a880..b75abef2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,11 +2,6 @@ name: Rs on: push: - paths: - - rust/** - - Makefile - - _data/** - - .github/workflows/rust.yml env: CARGO_TERM_COLOR: always From ae05fa9520add2ac33a68bd5ab56bcf416835afd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:18:56 -0500 Subject: [PATCH 178/326] disable benchmarks when parallel --- python/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/Makefile b/python/Makefile index c7662f2b..9cbcb972 100644 --- a/python/Makefile +++ b/python/Makefile @@ -9,16 +9,18 @@ ifneq ($(MYPY),true) LINT=less endif +benchmark_flags=--benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose + ifeq ($(LINT),false) -pytest_args?= -vl --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose +pytest_args?= -vl else ifeq ($(LINT),true) pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort -k 'not test_problem and not test_is_prime and not test_groupwise' else ifeq ($(LINT),less) -pytest_args?= -vl --isort --benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose +pytest_args?= -vl --isort else -pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort --benchmark-min-time=0.05 --benchmark-group-by=fullfunc --benchmark-sort=fullname --benchmark-verbose +pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort endif endif endif @@ -38,12 +40,12 @@ endif endif test: dependencies _test + $(PY) -m pytest $(pytest_args) $(benchmark_flags) -test_%: - $(MAKE) test pytest_args="$(pytest_args) -n$*" $(MFLAGS) +test_%: dependencies + $(PY) -m pytest $(pytest_args) -n$* _test: - $(PY) -m pytest $(pytest_args) ifeq ($(MYPY),true) dependencies: From 5c3282fdcc78df61e0bfb7abf257c60756de0bf5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:21:53 -0500 Subject: [PATCH 179/326] move image --- README.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 4e44201a..43061a23 100644 --- a/README.rst +++ b/README.rst @@ -53,6 +53,8 @@ LivInTheLookingGlass’s Project Euler solutions | | |RustClippy| | +-------------------------------------------------+---------------+ +.. image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graphs/icicle.svg?token=6GHBNILEHG + This is the repository I keep for prospective employers to look at project Euler code that I have written. @@ -63,11 +65,6 @@ All solutions are tested against multiple operating systems and language/compiler versions. For more information, see ``.github/workflows/`` -Coverage Graph --------------- - -.. image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graphs/icicle.svg?token=6GHBNILEHG - This is NOT meant to help others on Project Euler problems ---------------------------------------------------------- From 31f2afa634a4173a26a9590fd48e97cdc8f51915 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:24:53 -0500 Subject: [PATCH 180/326] Fix Makefile docs --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 5ba50cee..b82b6007 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -79,7 +79,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi .. make:target:: % If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, - ``make test`` would be translated to ``make cstest ctest jstest pytest rstest`` + ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` .. toctree:: :maxdepth: 2 From 404a08208200791b7da8d5aecf371e24d965af19 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:32:36 -0500 Subject: [PATCH 181/326] fix typo --- docs/c/iterator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst index 7e9281d7..a482fb4c 100644 --- a/docs/c/iterator.rst +++ b/docs/c/iterator.rst @@ -36,7 +36,7 @@ iterator.h An indicator that flips every time the iterator moves. -.. c:macro:: IteratotionHead(it) +.. c:macro:: IterationHead(it) This macro implements the base functionality of all :c:macro:`Iterator ` functions. It must be at the top of all iteration functions, with the iterator passed From 0cdc6d326b45554ab453f80d44ec16d5bd6e15f7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:32:46 -0500 Subject: [PATCH 182/326] remove system rust, cargo --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b75abef2..2605c1cf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -47,6 +47,8 @@ jobs: steps: - uses: actions/checkout@v4 + - run: sudo apt-get remove -y rust cargo + - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} From 59e6d49b168958a064b715060383b1c556aeec53 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:37:03 -0500 Subject: [PATCH 183/326] disable graalpy benchmarks, linting --- .github/workflows/python.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8f739ded..a71dc253 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -65,10 +65,14 @@ jobs: python/requirements.txt c/requirements.txt - - name: Run tests (serially) - if: ${{(matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy')}} + - name: Run tests (serially, benchmarked, linted) + if: ${{matrix.os == 'ubuntu-latest' && matrix.version == '3.12'}} run: make py_test COV=true + - name: Run tests (serially) + if: ${{contains(matrix.version, 'graalpy')}} + run: make py_test LINT=false COV=true benchmark_flags= + - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} run: make py_test_auto LINT=false COV=true From bfe04ab783342fd9f200de7104327469e36d1966 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:48:08 -0500 Subject: [PATCH 184/326] fix conditional --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2605c1cf..8583dbf9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -48,6 +48,7 @@ jobs: - uses: actions/checkout@v4 - run: sudo apt-get remove -y rust cargo + if: ${{ contains(matrix.os, 'ubuntu') }} - uses: actions-rs/toolchain@v1 with: From 035f8d046aeb59db3226f3ea411b057732eee255 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 00:54:46 -0500 Subject: [PATCH 185/326] Add scheduled runs (first of each month) --- .github/workflows/c.yml | 3 +++ .github/workflows/csharp.yml | 3 +++ .github/workflows/javascript.yml | 3 +++ .github/workflows/pages.yml | 7 ++++++- .github/workflows/python.yml | 3 +++ .github/workflows/rust.yml | 3 +++ 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 99840400..fd913380 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -2,6 +2,9 @@ name: C on: push: + schedule: + cron: + - "0 0 1 * *" jobs: c-lint: diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index c73a6968..b314aa7f 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -2,6 +2,9 @@ name: C# on: push: + schedule: + cron: + - "0 0 1 * *" jobs: csharp: diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 7a05d1c1..6016c2cd 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -2,6 +2,9 @@ name: JS on: push: + schedule: + cron: + - "0 0 1 * *" jobs: javascript: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 7d26b456..6e389af7 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,6 +1,11 @@ name: Pages -on: [push, workflow_dispatch] +on: + push: + workflow_dispatch: + schedule: + cron: + - "0 0 1 * *" jobs: build: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a71dc253..5594bad9 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,6 +2,9 @@ name: Py on: push: + schedule: + cron: + - "0 0 1 * *" jobs: # python-lint: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8583dbf9..64080cd2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,6 +2,9 @@ name: Rs on: push: + schedule: + cron: + - "0 0 1 * *" env: CARGO_TERM_COLOR: always From afe606f59d6682c5a029b3af4e7792de07b22323 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:04:25 -0500 Subject: [PATCH 186/326] use less common runners to get queued sooner --- .github/workflows/pages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 6e389af7..70cd95ac 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -9,7 +9,7 @@ on: jobs: build: - runs-on: 'ubuntu-latest' + runs-on: 'ubuntu-22.04' steps: - uses: actions/checkout@v3 @@ -48,7 +48,7 @@ jobs: deploy: needs: build - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: pages: write # to deploy to Pages From 057d05ea57eab4c5b9bad1fc8ef7777be304091a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:32:37 -0500 Subject: [PATCH 187/326] Begin problems table --- docs/index.rst | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index b82b6007..d8836268 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -81,6 +81,48 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` ++-----------------+-----+------+------+------+------+ +| |**C**|**C#**|**Js**|**Py**|**Rs**| ++=================+=====+======+======+======+======+ +| Documentatation | ⏱ | | | | ⏱ | ++-----------------+-----+------+------+------+------+ +| Linting | | | | | | ++-----------------+-----+------+------+------+------+ +| Coverage | ✔ | ⏱ | | | ⏱ | ++=================+=====+======+======+======+======+ +| Problem 001 | ✔ | ✔ | ✔ | ✔ | ✔ | ++-----------------+-----+------+------+------+------+-+-----------------+-----+------+------+------+------+ +| Problem 002 | ✔ | ✔ | ✔ | ✔ | ✔ | ++-----------------+-----+------+------+------+------+ +| Problem 003 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 004 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 005 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 006 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 007 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 008 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 009 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 010 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 011 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 012 | ⏱ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 013 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 014 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 015 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 016 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ + .. toctree:: :maxdepth: 2 From 39b7733630f0dab7500eec8e84a061ad588f33f5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:34:33 -0500 Subject: [PATCH 188/326] package typo --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 64080cd2..648e335d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v4 - - run: sudo apt-get remove -y rust cargo + - run: sudo apt-get remove -y rustc cargo if: ${{ contains(matrix.os, 'ubuntu') }} - uses: actions-rs/toolchain@v1 From b83063f432afb61ade59a41b6a92dd98b5a5ecae Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:39:17 -0500 Subject: [PATCH 189/326] fix schedule --- .github/workflows/c.yml | 3 +-- .github/workflows/csharp.yml | 3 +-- .github/workflows/javascript.yml | 3 +-- .github/workflows/pages.yml | 3 +-- .github/workflows/python.yml | 3 +-- .github/workflows/rust.yml | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index fd913380..cb1289f0 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -3,8 +3,7 @@ name: C on: push: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 1 * *" jobs: c-lint: diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index b314aa7f..2edd0bb8 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -3,8 +3,7 @@ name: C# on: push: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 1 * *" jobs: csharp: diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 6016c2cd..9f8498dd 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -3,8 +3,7 @@ name: JS on: push: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 1 * *" jobs: javascript: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 70cd95ac..bf391c51 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,8 +4,7 @@ on: push: workflow_dispatch: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 * * 1" jobs: build: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5594bad9..d24a0e06 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -3,8 +3,7 @@ name: Py on: push: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 1 * *" jobs: # python-lint: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 648e335d..5226a742 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,8 +3,7 @@ name: Rs on: push: schedule: - cron: - - "0 0 1 * *" + - cron: "0 0 1 * *" env: CARGO_TERM_COLOR: always From 48f5c66caa89fe79ce4f5839af8d44ebf46b5e6d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:46:04 -0500 Subject: [PATCH 190/326] attempt to fox table --- docs/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d8836268..2f65bf19 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -89,9 +89,9 @@ This project is divided into several Makefiles, connected by a root Makefile whi | Linting | | | | | | +-----------------+-----+------+------+------+------+ | Coverage | ✔ | ⏱ | | | ⏱ | -+=================+=====+======+======+======+======+ ++-----------------+-----+------+------+------+------+ | Problem 001 | ✔ | ✔ | ✔ | ✔ | ✔ | -+-----------------+-----+------+------+------+------+-+-----------------+-----+------+------+------+------+ ++-----------------+-----+------+------+------+------+ | Problem 002 | ✔ | ✔ | ✔ | ✔ | ✔ | +-----------------+-----+------+------+------+------+ | Problem 003 | ✔ | | | ✔ | | From 672c043fb5868ebac279b833556ecde752dede3f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 01:54:13 -0500 Subject: [PATCH 191/326] rename job --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5226a742..f59cd591 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ env: jobs: build_and_test: - name: Rust project - latest + name: Rust runs-on: ${{ matrix.os }} strategy: fail-fast: false From 98cc0e0ad9433f937fb2c95f0f4538b687871f7d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 02:26:27 -0500 Subject: [PATCH 192/326] add external references --- docs/c/iterator.rst | 2 +- docs/conf.py | 7 +++ docs/index.rst | 120 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 122 insertions(+), 7 deletions(-) diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst index a482fb4c..a817ddf2 100644 --- a/docs/c/iterator.rst +++ b/docs/c/iterator.rst @@ -60,7 +60,7 @@ iterator.h This is an example implementation of the :c:macro:`Iterator ` API used in this project. You can construct it using any of the factory functions found below, and it is generally used much like Python's - :py:ref:`range` object. + :external:py:ref:`range` object. .. c:member:: uintmax_t (*iterator_function)(counter *it) diff --git a/docs/conf.py b/docs/conf.py index 52faad64..21d4a8e5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,11 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', + 'sphinx.ext.extlinks', 'sphinx.ext.githubpages', 'sphinx.ext.graphviz', 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.todo', # 'breathe', @@ -55,3 +57,8 @@ # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration todo_include_todos = True + +extlinks = {'prob': ('https://projecteuler.net/problem=%#d', + 'Problem %03#d')} + +intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} diff --git a/docs/index.rst b/docs/index.rst index 2f65bf19..f87242d8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -84,17 +84,17 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------------+-----+------+------+------+------+ | |**C**|**C#**|**Js**|**Py**|**Rs**| +=================+=====+======+======+======+======+ -| Documentatation | ⏱ | | | | ⏱ | +| Documentatation | ⏱ | ✔ | ✔ | ✔ | ⏱ | +-----------------+-----+------+------+------+------+ -| Linting | | | | | | +| Linting | ✔ | ✔ | ✔ | ✔ | ✔ | +-----------------+-----+------+------+------+------+ -| Coverage | ✔ | ⏱ | | | ⏱ | +| Coverage | ✔ | ⏱ | ✔ | ✔ | ⏱ | +-----------------+-----+------+------+------+------+ -| Problem 001 | ✔ | ✔ | ✔ | ✔ | ✔ | +| :prob:`1` | ✔ | ✔ | ✔ | ✔ | ✔ | +-----------------+-----+------+------+------+------+ -| Problem 002 | ✔ | ✔ | ✔ | ✔ | ✔ | +| :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | +-----------------+-----+------+------+------+------+ -| Problem 003 | ✔ | | | ✔ | | +| :prob:`3` | ✔ | | | ✔ | | +-----------------+-----+------+------+------+------+ | Problem 004 | ✔ | | | ✔ | | +-----------------+-----+------+------+------+------+ @@ -122,6 +122,114 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------------+-----+------+------+------+------+ | Problem 016 | ✔ | | | ✔ | | +-----------------+-----+------+------+------+------+ +| Problem 017 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 018 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 019 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 020 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 021 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 022 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 023 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 024 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 025 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 027 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 029 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 030 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 031 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 032 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 033 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 034 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 035 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 036 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 037 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 038 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 039 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 040 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 041 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 042 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 043 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 044 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 045 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 046 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 047 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 048 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 049 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 050 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 052 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 053 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 055 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 056 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 057 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 059 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 067 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 069 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 071 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 073 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 074 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 076 | ✔ | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 077 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 087 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 092 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 097 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 118 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 123 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 134 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 145 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 187 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ +| Problem 206 | | | | ✔ | | ++-----------------+-----+------+------+------+------+ .. toctree:: :maxdepth: 2 From 7f8028b6e5399e13ed9b89c388e91c04e0b29de7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 02:31:30 -0500 Subject: [PATCH 193/326] try to force rust version --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f59cd591..b94d0436 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -56,7 +56,7 @@ jobs: with: toolchain: ${{ matrix.toolchain }} - - run: cd rust && cargo build + - run: rustup default ${{ matrix.toolchain }} - run: cd rust && cargo test if: ${{ matrix.toolchain != 'nightly' }} From b25b842a014d3fe1285300786839f197ed20bf0d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 02:41:42 -0500 Subject: [PATCH 194/326] fix external link format --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 21d4a8e5..6d55aed8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,7 +58,7 @@ todo_include_todos = True -extlinks = {'prob': ('https://projecteuler.net/problem=%#d', - 'Problem %03#d')} +extlinks = {'prob': ('https://projecteuler.net/problem=%s', + 'Problem \#%s')} intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} From f730a3c86930837980eeaaa807e0841f58c74f48 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 02:46:31 -0500 Subject: [PATCH 195/326] try to fix grcov --- .github/workflows/rust.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b94d0436..50c79788 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -49,9 +49,6 @@ jobs: steps: - uses: actions/checkout@v4 - - run: sudo apt-get remove -y rustc cargo - if: ${{ contains(matrix.os, 'ubuntu') }} - - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} @@ -70,7 +67,7 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov -r rust + run: cargo install grcov && cd rust && grcov - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} From b48047021bfa5f3b7558475a02c6e26ad9991f42 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 02:49:03 -0500 Subject: [PATCH 196/326] fix unnecessary escape --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 6d55aed8..6ded628e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,6 +59,6 @@ todo_include_todos = True extlinks = {'prob': ('https://projecteuler.net/problem=%s', - 'Problem \#%s')} + 'Problem #%s')} intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} From 9e28890c5afbc2b955254b45fadfc1a46c7028e6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 10:49:15 -0500 Subject: [PATCH 197/326] disable coverage for graalpy (too slow) --- .github/workflows/python.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index d24a0e06..746b3b9f 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -73,13 +73,14 @@ jobs: - name: Run tests (serially) if: ${{contains(matrix.version, 'graalpy')}} - run: make py_test LINT=false COV=true benchmark_flags= + run: make py_test LINT=false benchmark_flags= - name: Run tests (in parallel) if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} run: make py_test_auto LINT=false COV=true - name: Upload coverage reports to Codecov + if: ${{!contains(matrix.version, 'graalpy')}} uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 3ad1704256178cfac63c0a541e4c1bfe613474fd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 10:51:23 -0500 Subject: [PATCH 198/326] remove unsupported versions, fix grcov --- .github/workflows/rust.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 50c79788..63e8d8b7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,20 +27,6 @@ jobs: os: macos-13 - toolchain: stable os: macos-latest - - toolchain: "1.1" - os: ubuntu-latest - - toolchain: "1.10" - os: ubuntu-latest - - toolchain: "1.20" - os: ubuntu-latest - - toolchain: "1.28" - os: ubuntu-latest - - toolchain: "1.30" - os: ubuntu-latest - - toolchain: "1.40" - os: ubuntu-latest - - toolchain: "1.50" - os: ubuntu-latest - toolchain: "1.60" os: ubuntu-latest - toolchain: "1.70" @@ -67,7 +53,7 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && cd rust && grcov + run: cargo install grcov && grcov rust - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} From 9abf95c106975aa2d1ba1adf1d7f8a0c7fdc0a1f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 10:52:22 -0500 Subject: [PATCH 199/326] update version --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 43061a23..58ef7342 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.1+ | 2 / |total| | |Rust| | +| Rust | 1.60+ | 2 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ From dfdeee6741942c1814339069aa0afd39ea7ef3a3 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 11:06:02 -0500 Subject: [PATCH 200/326] Update rust version --- .github/workflows/rust.yml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 63e8d8b7..8a835299 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: os: macos-13 - toolchain: stable os: macos-latest - - toolchain: "1.60" + - toolchain: "1.67.1" os: ubuntu-latest - toolchain: "1.70" os: ubuntu-latest diff --git a/README.rst b/README.rst index 58ef7342..ced5a9d7 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.60+ | 2 / |total| | |Rust| | +| Rust | 1.67.1+ | 2 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ From 4c71e31dae84cf674ed2c2c17c7ccf9b41386929 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 11:26:17 -0500 Subject: [PATCH 201/326] update rust version (again) --- .github/workflows/rust.yml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8a835299..48c46b9f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,7 +27,7 @@ jobs: os: macos-13 - toolchain: stable os: macos-latest - - toolchain: "1.67.1" + - toolchain: "1.69" os: ubuntu-latest - toolchain: "1.70" os: ubuntu-latest diff --git a/README.rst b/README.rst index ced5a9d7..e6ee1358 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.67.1+ | 2 / |total| | |Rust| | +| Rust | 1.69+ | 2 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ From 87c181538b713f9550d8579a7be1b17addfdb467 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 12:58:24 -0500 Subject: [PATCH 202/326] Compress table more --- docs/index.rst | 298 ++++++++++++++++++++++++------------------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index f87242d8..137011b7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -81,155 +81,155 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` -+-----------------+-----+------+------+------+------+ -| |**C**|**C#**|**Js**|**Py**|**Rs**| -+=================+=====+======+======+======+======+ -| Documentatation | ⏱ | ✔ | ✔ | ✔ | ⏱ | -+-----------------+-----+------+------+------+------+ -| Linting | ✔ | ✔ | ✔ | ✔ | ✔ | -+-----------------+-----+------+------+------+------+ -| Coverage | ✔ | ⏱ | ✔ | ✔ | ⏱ | -+-----------------+-----+------+------+------+------+ -| :prob:`1` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-----------------+-----+------+------+------+------+ -| :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-----------------+-----+------+------+------+------+ -| :prob:`3` | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 004 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 005 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 006 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 007 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 008 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 009 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 010 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 011 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 012 | ⏱ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 013 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 014 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 015 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 016 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 017 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 018 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 019 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 020 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 021 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 022 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 023 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 024 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 025 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 027 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 029 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 030 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 031 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 032 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 033 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 034 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 035 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 036 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 037 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 038 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 039 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 040 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 041 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 042 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 043 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 044 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 045 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 046 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 047 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 048 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 049 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 050 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 052 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 053 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 055 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 056 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 057 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 059 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 067 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 069 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 071 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 073 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 074 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 076 | ✔ | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 077 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 087 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 092 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 097 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 118 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 123 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 134 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 145 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 187 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ -| Problem 206 | | | | ✔ | | -+-----------------+-----+------+------+------+------+ ++-------------+-----+------+------+------+------+ +| |**C**|**C#**|**Js**|**Py**|**Rs**| ++=============+=====+======+======+======+======+ +| Coverage | ✔ | ⏱ | ✔ | ✔ | ⏱ | ++-------------+-----+------+------+------+------+ +| Docs | ⏱ | ✔ | ✔ | ✔ | ⏱ | ++-------------+-----+------+------+------+------+ +| Linting | ✔ | ✔ | ✔ | ✔ | ✔ | ++-------------+-----+------+------+------+------+ +| :prob:`1` | ✔ | ✔ | ✔ | ✔ | ✔ | ++-------------+-----+------+------+------+------+ +| :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | ++-------------+-----+------+------+------+------+ +| :prob:`3` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`4` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`5` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`6` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`7` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`8` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`9` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`10` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`11` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`12` | ⏱ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`13` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`14` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`15` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`16` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`17` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`18` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`19` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`20` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`21` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`22` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`23` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`24` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`25` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`27` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`29` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`30` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`31` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`32` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`33` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`34` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`35` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`36` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`37` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`38` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`39` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`40` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`41` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`42` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`43` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`44` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`45` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`46` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`47` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`48` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`49` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`50` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`52` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`53` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`55` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`56` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`57` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`59` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`67` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`69` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`71` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`73` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`74` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`76` | ✔ | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`77` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`87` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`92` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`97` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`118` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`123` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`134` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`145` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`187` | | | | ✔ | | ++-------------+-----+------+------+------+------+ +| :prob:`206` | | | | ✔ | | ++-------------+-----+------+------+------+------+ .. toctree:: :maxdepth: 2 From 7ed67a3eee6312cbbbbd34769ed01527e015a31c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 15:54:46 -0500 Subject: [PATCH 203/326] Add bcd_int docs --- c/include/bcd.h | 6 +-- docs/c/bcd.rst | 113 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/conf.py | 26 +++++++---- 3 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 docs/c/bcd.rst diff --git a/c/include/bcd.h b/c/include/bcd.h index 2fdf4171..741f0e16 100644 --- a/c/include/bcd.h +++ b/c/include/bcd.h @@ -550,9 +550,9 @@ uintmax_t bcd_to_unsigned(BCD_int a) { return answer; } -uintmax_t bcd_to_signed(BCD_int a); -inline uintmax_t bcd_to_signed(BCD_int a) { - uintmax_t answer = bcd_to_unsigned(a); +intmax_t bcd_to_signed(BCD_int a); +inline intmax_t bcd_to_signed(BCD_int a) { + intmax_t answer = (intmax_t) bcd_to_unsigned(a); if (a.negative) return -answer; return answer; diff --git a/docs/c/bcd.rst b/docs/c/bcd.rst new file mode 100644 index 00000000..eb708948 --- /dev/null +++ b/docs/c/bcd.rst @@ -0,0 +1,113 @@ +bcd.h +===== + +This library implements a `Binary Coded Decimal `__ object in C. Mostly +this is done to prove that I could, but also because it allows for incredibly easy printing of arbitrary-sized integers. +It was also a good exercise in x86 assembly, as several portions are accellerated by handcrafted assembly. + +.. c:namespace-push:: bcd + +.. c:type:: unsigned char packed_BCD_pair + + This is an alias to distinguish BCD digit-pairs from normal characters. + +.. c:type:: BCD_int + + .. c:member:: packed_BCD_pair *digits + + This array holds the digit-pairs that encode the number. Because of this, you must use :c:ref:`free_bcd` to destroy + these objects without leaking memory. + + .. c:member:: size_t bcd_digits + + This field indicates the size of the array. It DOES NOT match the number of decimal digits. + + .. c:member:: size_t decimal_digits + + This field indicates the number of decimal digits encoded. It should be within 1 of ``2*bcd_digits``. + + .. c:member:: bool negative : 1 + + Since digits are encoded by absolute value, this field tells you if the number is negative. + + .. c:member:: bool zero : 1 + + Shortcut value to determine if the encoded integer is 0. + + .. c:function:: void free_BCD_int(BCD_int x) + + .. c:function:: BCD_int new_BCD_int(uintmax_t a, bool negative) + + .. c:function:: BCD_int BCD_from_bytes(const unsigned char *str, size_t chars, bool negative, bool little_endian) + + Takes in an arbitrary-sized encoded integer (like in Python's :external:python:ref:`int.from_bytes`) to a + :c:type:`BCD_int`. + + .. c:function:: BCD_int BCD_from_ascii(const char *str, size_t digits, bool negative) + + From an ASCII-encoded integer to a :c:ref:`BCD_int`. + +.. c:function:: BCD_int add_bcd(BCD_int x, BCD_int y) + + Returns ``x + y``. + +.. c:function:: BCD_int sub_bcd(BCD_int x, BCD_int y) + + Returns ``x - y``. + +.. c:function:: BCD_int mul_bcd_cuint(BCD_int x, uintmax_t y) + + Returns ``x * y``, handling type conversion for you. + +.. c:function:: BCD_int pow_cuint_cuint(uintmax_t x, uintmax_t y) + + Returns ``x ** y``, handling type conversion for you. + +.. c:function:: BCD_int mul_bcd(BCD_int x, BCD_int y) + + Returns ``x * y``. + +.. c:function:: BCD_int pow_bcd(BCD_int x, BCD_int y) + + Returns ``x ** y``. + +.. c:function:: BCD_int mul_bcd_pow_10(BCD_int x, uintmax_t tens) +.. c:function:: BCD_int shift_bcd_left(BCD_int x, uintmax_t tens) + + Returns ``x * 10**tens``. + +.. c:function:: BCD_int div_bcd_pow_10(BCD_int a, uintmax_t tens) +.. c:function:: BCD_int shift_bcd_right(BCD_int a, uintmax_t tens) + + Returns ``x // 10**tens``. + +.. c:function:: signed char cmp_bcd(BCD_int x, BCD_int y) + + Returns 1 if ``x > y``, -1 if ``y > x``, and otherwise 0. + +.. c:function:: void print_bcd(BCD_int x) +.. c:function:: void print_bcd_ln(BCD_int x) + + Writes a :c:type:`BCD_int` to `stdout`, and optionally adds a newline. + +.. c:function:: uintmax_t bcd_to_unsigned(BCD_int a) + + Converts a :c:type:`BCD_int` to an unsigned integer. + + .. warning:: + + This method DOES NOT guard against overflow. + +.. c:function:: intmax_t bcd_to_signed(BCD_int a) + + Converts a :c:type:`BCD_int` to a signed integer. + + .. warning:: + + This method DOES NOT guard against overflow. + +.. c:function:: unsigned short mul_dig_pair(packed_BCD_pair ab, packed_BCD_pair cd) + + Convenience method to multiply a digit pair. + +.. c:namespace-pop:: diff --git a/docs/conf.py b/docs/conf.py index 6ded628e..6d41b59c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,12 +6,14 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -import os -import sys -basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -sys.path.insert(0, basedir) -sys.path.insert(0, basedir + os.sep + 'python') -js_source_path = basedir + os.sep + 'javascript' +from os import environ, path, sep +from subprocess import CalledProcessError, check_call +from sys import path as sys_path + +basedir = path.abspath(path.join(path.dirname(__file__), '..')) +sys_path.insert(0, basedir) +sys_path.insert(0, basedir + sep + 'python') +js_source_path = basedir + sep + 'javascript' rust_crates = ["../rust"] project = 'Euler' @@ -38,8 +40,16 @@ 'sphinx_csharp.csharp', 'sphinxcontrib.makedomain', ] -if 'TERMUX_VERSION' not in os.environ: - extensions.append('sphinx_js') + +try: + check_call(['rpm-ostree', '--version']) + IS_SILVERBLUE = True +except CalledProcessError: + IS_SILVERBLUE = False + +if 'TERMUX_VERSION' not in environ: + if not IS_SILVERBLUE: + extensions.append('sphinx_js') extensions.append('sphinx_rust') templates_path = ['_templates'] From 80c6109bae9a8840dec8117ceb1c6521bcc0f784 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 15:57:27 -0500 Subject: [PATCH 204/326] Make catch general --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 6d41b59c..47bc70de 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -44,7 +44,7 @@ try: check_call(['rpm-ostree', '--version']) IS_SILVERBLUE = True -except CalledProcessError: +except Exception: IS_SILVERBLUE = False if 'TERMUX_VERSION' not in environ: From 2f0f3f6909caab64440e41c84c3738769a02ba56 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 16:37:40 -0500 Subject: [PATCH 205/326] Add primes docs --- c/include/primes.h | 2 +- docs/c/primes.rst | 136 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 docs/c/primes.rst diff --git a/c/include/primes.h b/c/include/primes.h index ae67dd68..312d1534 100644 --- a/c/include/primes.h +++ b/c/include/primes.h @@ -146,7 +146,7 @@ struct prime_sieve { * The iterator that implements a modified sieve of eratosthenes * @iterator_function: The function to advance the iterator and return the next element * @exhausted: An indicator that tells you if the iterator is exhausted - * @started: An indicator that tells you if the interator has moved at all + * @started: An indicator that tells you if the iterator has moved at all * @phase: An indicator that flips every time the iterator moves * @sieve: The sieve state used to generate new primes * @sieve_len: The length of the sieve state (divided by 2) diff --git a/docs/c/primes.rst b/docs/c/primes.rst new file mode 100644 index 00000000..520fa110 --- /dev/null +++ b/docs/c/primes.rst @@ -0,0 +1,136 @@ +primes.h +======== + +.. c:namespace-push:: primes + +.. c:type:: prime_counter + + Implements the :c:macro:`Iterator ` API + and yields successive prime numbers. + + .. c:member:: uintmax_t (*iterator_function)(*prime_counter) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the interator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves + + .. c:member:: size_t idx + + The current position of the counter. + + .. c:member:: uintmax_t stop + + The point where the counter is exhausted. + + .. c:member:: prime_sieve *ps + + .. c:function:: prime_counter prime_counter1(uintmax_t stop) + + .. c:function:: prime_counter prime_counter0() + + .. c:function:: void free_prime_counter(prime_counter pc) + +.. c:type:: prime_sieve + + An :c:macro:`Iterator ` that implements a modified sieve of eratosthenes + + .. c:member:: uintmax_t (*iterator_function)(*prime_sieve) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the iterator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves. + + .. c:member:: uintmax_t *sieve + + The sieve state used to generate new primes. + + .. c:member:: size_t sieve_len + + The length of the sieve state (divided by 2). + + .. c:member:: uintmax_t prime + + The current reference prime. + + .. c:member:: uintmax_t prime_squared + + The reference prime squared. + + .. c:member:: uintmax_t candidate + + The current candidate prime number. + + .. c:member:: prime_counter source + + The source of new reference prime numbers. + + .. c:function:: prime_sieve prime_sieve0() + + .. c:function:: void free_prime_sieve(prime_sieve ps) + +.. c:type:: prime_factor_counter + + Implements the :c:macro:`Iterator ` API + and yields successive prime factors. + + .. c:member:: uintmax_t (*iterator_function)(*prime_factor_counter) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the interator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves. + + .. c:member:: uintmax_t target + + The number you are trying to factorize. + + .. c:member:: uintmax_t current + + The current candidate prime factor. + + .. c:member:: prime_counter pc + + The source of new prime numbers + + .. c:function:: prime_factor_counter prime_factors(uintmax_t n) + + .. c:macro:: free_prime_factor_counter(pfc) + +.. c:function:: uintmax_t is_composite(uintmax_t n) + + Tells you if a number is composite, and if so, its smallest prime factor. + +.. c:function:: bool is_prime(uintmax_t n) + + Tests if a number is prime. + +.. c:namespace-pop:: From 39a606ce294d1e46ce3038f62462295243417a38 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 17:47:22 -0500 Subject: [PATCH 206/326] Add math docs --- docs/c/math.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 docs/c/math.rst diff --git a/docs/c/math.rst b/docs/c/math.rst new file mode 100644 index 00000000..01400d75 --- /dev/null +++ b/docs/c/math.rst @@ -0,0 +1,39 @@ +math.h +====== + +.. c:namespace-push:: math + +.. c:macro:: MAX_FACTORIAL_64 20 + +.. c:macro:: MAX_FACTORIAL_128 34 + +.. c:function:: uintmax_t factorial(unsigned int n) + + .. warning:: + + This function only works for numbers smaller than + :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAC_FACTORIAL_128`, + depending on the size of `uintmax_t`. + +.. c:function:: uintmax_t n_choose_r(unsigned int n, unsigned int r) + + Returns -1 if there is an overflow. Otherwise returns n choose r. + + .. warning:: + + This function only works for numbers smaller than + :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAC_FACTORIAL_128`, + depending on the size of `uintmax_t`. + +.. note:: + + The following are only available or necessary for the ``pcc`` compiler, as it has + a hard time including ``. + +.. c:function:: unsigned char imprecise_log10(uintmax_t x) + +.. c:function:: double sqrt(double S) + +.. c:function:: uintmax_t ceil(double x) + +.. c:namespace-pop:: From 0f30305bf8d85edfdccb9859d426e81f85c7c834 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:03:36 -0500 Subject: [PATCH 207/326] Add macros documentation --- docs/c/macros.rst | 60 +++++++++++++++++++++++++++++++++++++++++++++++ docs/c/math.rst | 14 ++++------- 2 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 docs/c/macros.rst diff --git a/docs/c/macros.rst b/docs/c/macros.rst new file mode 100644 index 00000000..ffe12da8 --- /dev/null +++ b/docs/c/macros.rst @@ -0,0 +1,60 @@ +macros.h +======== + +.. c:namespace-push:: macros + +.. c:macro:: CL_COMPILER +.. c:macro:: CLANG_COMPILER +.. c:macro:: GCC_COMPILER +.. c:macro:: INTEL_COMPILER +.. c:macro:: AMD_COMPILER +.. c:macro:: PCC_COMPILER +.. c:macro:: TCC_COMPILER + + These macros detect which compiler the program is being made with. They will be 1 + if it is that compiler, and 0 otherwise. + + .. warning:: + + This suite is not able to detect the difference between ``clang`` and ``aocc`` + without assistance. Please define :c:macro:`AMD_COMPILER` manually if on + ``clang`` or ``aocc``. + +.. c:macro:: X64_COMPILER +.. c:macro:: X86_COMPILER +.. c:macro:: ARM_COMPILER +.. c:macro:: ARM_THUMB + + These macros attempt to detect the architecture the program is being compiled for. + +.. c:macro:: static + + .. note:: + + This macro only exists on ``pcc`` because it does not allow reproducible builds + with static variables. + +.. c:macro:: max(a, b) +.. c:macro:: min(a, b) + + If these were not already defined, this header makes them + +.. c:macro:: likely(x) +.. c:macro:: unlikely(x) + + These macros implement the ``likely()`` and ``unlikely()`` flags, as in the Linux kernel to + assist in branch prediction. On ``tcc`` and ``cl`` it has no effect. + +.. c:macro:: MAX_FACTORIAL_64 20 +.. c:macro:: MAX_FACTORIAL_128 34 +.. c:macro:: PCC_SQRT_ACCURACY 8 +.. c:macro:: MAX_POW_10_16 10000U +.. c:macro:: POW_OF_MAX_POW_10_16 4 +.. c:macro:: MAX_POW_10_32 1000000000UL +.. c:macro:: POW_OF_MAX_POW_10_32 9 +.. c:macro:: MAX_POW_10_64 10000000000000000000ULL +.. c:macro:: POW_OF_MAX_POW_10_64 19 +.. c:macro:: MAX_POW_10_128 ((uintmax_t) MAX_POW_10_64 * (uintmax_t) MAX_POW_10_64) +.. c:macro:: POW_OF_MAX_POW_10_128 38 + +.. c:namespace-pop:: diff --git a/docs/c/math.rst b/docs/c/math.rst index 01400d75..63e8b1cf 100644 --- a/docs/c/math.rst +++ b/docs/c/math.rst @@ -2,18 +2,14 @@ math.h ====== .. c:namespace-push:: math - -.. c:macro:: MAX_FACTORIAL_64 20 - -.. c:macro:: MAX_FACTORIAL_128 34 .. c:function:: uintmax_t factorial(unsigned int n) .. warning:: This function only works for numbers smaller than - :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAC_FACTORIAL_128`, - depending on the size of `uintmax_t`. + :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAX_FACTORIAL_128`, + depending on the size of ``uintmax_t``. .. c:function:: uintmax_t n_choose_r(unsigned int n, unsigned int r) @@ -22,13 +18,13 @@ math.h .. warning:: This function only works for numbers smaller than - :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAC_FACTORIAL_128`, - depending on the size of `uintmax_t`. + :c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAX_FACTORIAL_128`, + depending on the size of ``uintmax_t``. .. note:: The following are only available or necessary for the ``pcc`` compiler, as it has - a hard time including ``. + a hard time including ````. .. c:function:: unsigned char imprecise_log10(uintmax_t x) From ff3f8a2c3a9c011e94cd0ee47c9bcf0c4bef3766 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:12:07 -0500 Subject: [PATCH 208/326] Add digits, fibonacci --- docs/c.rst | 1 + docs/c/digits.rst | 39 +++++++++++++++++++++++++++++++++++++++ docs/c/fibonacci.rst | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 docs/c/digits.rst create mode 100644 docs/c/fibonacci.rst diff --git a/docs/c.rst b/docs/c.rst index 2d031a14..b8baa66a 100644 --- a/docs/c.rst +++ b/docs/c.rst @@ -16,6 +16,7 @@ Library Code c/bcd c/digits c/factors + c/fibonacci c/iterator c/macros c/math diff --git a/docs/c/digits.rst b/docs/c/digits.rst new file mode 100644 index 00000000..bb0693ef --- /dev/null +++ b/docs/c/digits.rst @@ -0,0 +1,39 @@ +digits.h +======== + +.. c:namespace-push:: digits + +.. c:type:: digit_counter + + Implements the :c:macro:`Iterator ` API + and yields successive decimal digits of a given number. + + .. c:member:: unsigned char (*iterator_function)(*digit_counter) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the interator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves. + + .. c:member:: unsigned char *digits + + This array holds the individual digits of a parsed integer. + + .. c:member:: size_t idx + + This represents the current position in :c:member:`digits`. + + .. c:function:: digit_counter digits(uintmax_t n) + + .. c:function:: void free_digit_counter(digit_counter dc) + +.. c:namespace-pop:: diff --git a/docs/c/fibonacci.rst b/docs/c/fibonacci.rst new file mode 100644 index 00000000..18a2b190 --- /dev/null +++ b/docs/c/fibonacci.rst @@ -0,0 +1,38 @@ +fibonacci.h +======== + +.. c:namespace-push:: fibonacci + +.. c:type:: fibonacci + + Implements the :c:macro:`Iterator ` API + and yields successive Fibonacci numbers. + + .. c:member:: uintmax_t (*iterator_function)(*digit_counter) + + The function to advance the iterator and return the next element. + + .. c:member:: bool exhausted : 1 + + An indicator that tells you if the iterator is exhausted. + + .. c:member:: bool started : 1 + + An indicator that tells you if the interator has moved at all. + + .. c:member:: bool phase : 1 + + An indicator that flips every time the iterator moves. + + .. c:member:: uintmax_t a + .. c:member:: uintmax_t b + + .. c:member:: uintmax_t limit + + This represents the largest number the iterator is allowed to yield. + + .. c:function:: fibonacci fibonacci1(uintmax_t limit) + + .. c:function:: fibonacci fibonacci0() + +.. c:namespace-pop:: From 9205a06b9d39cbe8aa447c3f0b06f279ca85608d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:53:51 -0500 Subject: [PATCH 209/326] Split types as advised by rust-clippy --- rust/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index e433af1b..b5df7267 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,7 +9,9 @@ use rstest::rstest; mod p0001; mod p0002; -const ANSWERS: [(&str, fn() -> u64, u64); 2] = [ +type ProblemType = fn() -> u64; +type ProblemRef = (&str, ProblemType, u64); +const ANSWERS: [ProblemRef; 2] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732) ]; From 867a8de129c1a97b521b9bf305f803e7c53312ae Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:54:22 -0500 Subject: [PATCH 210/326] Make rust-clippy fix paths Also have it ignore unneeded returns, as I like having them be explicit --- .github/workflows/rust-clippy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 7d44f188..b2466821 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -45,7 +45,12 @@ jobs: run: cd rust && cargo clippy --all-features - --message-format=json | clippy-sarif | tee ../rust-clippy-results.sarif | sarif-fmt + --message-format=json -- + -A clippy::needless_return | + sed 's#src/#rust/src/#' | + clippy-sarif| + tee ../rust-clippy-results.sarif | + sarif-fmt - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v1 From 125042b9403023312499e72dd0ef6d64ae812796 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 19:09:04 -0500 Subject: [PATCH 211/326] Fix type error, include modules dynamically --- rust/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index b5df7267..35d55897 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,16 +1,16 @@ #[cfg(test)] use std::time::Duration; -#[cfg(test)] use seq_macro::seq; #[cfg(test)] use rstest::rstest; -mod p0001; -mod p0002; +seq!(N in 0001..=0002 { +mod p~N; +}); type ProblemType = fn() -> u64; -type ProblemRef = (&str, ProblemType, u64); +type ProblemRef<'a> = (&'a str, ProblemType, u64); const ANSWERS: [ProblemRef; 2] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732) From a5f0c0db9af1abe6bac7623b39cb4792ee018aca Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 19:35:44 -0500 Subject: [PATCH 212/326] More progress on C documentation --- docs/c/bcd.rst | 6 +++--- docs/c/fibonacci.rst | 2 +- docs/c/iterator.rst | 2 +- docs/c/macros.rst | 37 +++++++++++++++++++++---------------- docs/c/math.rst | 6 ++---- docs/c/p0002.rst | 7 +++---- docs/c/p0003.rst | 7 +++---- docs/c/p0004.rst | 7 +++---- docs/c/p0005.rst | 8 ++++---- docs/c/p0006.rst | 6 ------ docs/c/p0007.rst | 7 +++---- docs/c/p0008.rst | 7 +++---- docs/c/p0009.rst | 6 ------ docs/c/p0010.rst | 7 +++---- docs/c/p0011.rst | 7 +++---- docs/c/p0012.rst | 11 +++++++---- docs/c/p0013.rst | 7 +++---- docs/c/p0014.rst | 7 +++---- docs/c/p0015.rst | 7 +++---- docs/c/p0016.rst | 7 +++---- docs/c/p0034.rst | 8 ++++---- docs/c/p0076.rst | 7 +++---- docs/c/primes.rst | 11 +++++------ 23 files changed, 84 insertions(+), 103 deletions(-) diff --git a/docs/c/bcd.rst b/docs/c/bcd.rst index eb708948..2b5a7b8a 100644 --- a/docs/c/bcd.rst +++ b/docs/c/bcd.rst @@ -72,12 +72,12 @@ It was also a good exercise in x86 assembly, as several portions are accellerate Returns ``x ** y``. .. c:function:: BCD_int mul_bcd_pow_10(BCD_int x, uintmax_t tens) -.. c:function:: BCD_int shift_bcd_left(BCD_int x, uintmax_t tens) + BCD_int shift_bcd_left(BCD_int x, uintmax_t tens) Returns ``x * 10**tens``. .. c:function:: BCD_int div_bcd_pow_10(BCD_int a, uintmax_t tens) -.. c:function:: BCD_int shift_bcd_right(BCD_int a, uintmax_t tens) + BCD_int shift_bcd_right(BCD_int a, uintmax_t tens) Returns ``x // 10**tens``. @@ -86,7 +86,7 @@ It was also a good exercise in x86 assembly, as several portions are accellerate Returns 1 if ``x > y``, -1 if ``y > x``, and otherwise 0. .. c:function:: void print_bcd(BCD_int x) -.. c:function:: void print_bcd_ln(BCD_int x) + void print_bcd_ln(BCD_int x) Writes a :c:type:`BCD_int` to `stdout`, and optionally adds a newline. diff --git a/docs/c/fibonacci.rst b/docs/c/fibonacci.rst index 18a2b190..3db3649e 100644 --- a/docs/c/fibonacci.rst +++ b/docs/c/fibonacci.rst @@ -25,7 +25,7 @@ fibonacci.h An indicator that flips every time the iterator moves. .. c:member:: uintmax_t a - .. c:member:: uintmax_t b + uintmax_t b .. c:member:: uintmax_t limit diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst index a817ddf2..894be617 100644 --- a/docs/c/iterator.rst +++ b/docs/c/iterator.rst @@ -49,7 +49,7 @@ iterator.h argument should be a pointer to its iteration function. .. c:macro:: next(state) -.. c:macro:: next_p(state) + next_p(state) These macros implement the iteration operation. The only difference between them is that :c:macro:`next` takes in a struct and diff --git a/docs/c/macros.rst b/docs/c/macros.rst index ffe12da8..5f6fca6a 100644 --- a/docs/c/macros.rst +++ b/docs/c/macros.rst @@ -4,12 +4,12 @@ macros.h .. c:namespace-push:: macros .. c:macro:: CL_COMPILER -.. c:macro:: CLANG_COMPILER -.. c:macro:: GCC_COMPILER -.. c:macro:: INTEL_COMPILER -.. c:macro:: AMD_COMPILER -.. c:macro:: PCC_COMPILER -.. c:macro:: TCC_COMPILER + CLANG_COMPILER + GCC_COMPILER + INTEL_COMPILER + AMD_COMPILER + PCC_COMPILER + TCC_COMPILER These macros detect which compiler the program is being made with. They will be 1 if it is that compiler, and 0 otherwise. @@ -21,9 +21,9 @@ macros.h ``clang`` or ``aocc``. .. c:macro:: X64_COMPILER -.. c:macro:: X86_COMPILER -.. c:macro:: ARM_COMPILER -.. c:macro:: ARM_THUMB + X86_COMPILER + ARM_COMPILER + ARM_THUMB These macros attempt to detect the architecture the program is being compiled for. @@ -35,26 +35,31 @@ macros.h with static variables. .. c:macro:: max(a, b) -.. c:macro:: min(a, b) + min(a, b) If these were not already defined, this header makes them .. c:macro:: likely(x) -.. c:macro:: unlikely(x) + unlikely(x) These macros implement the ``likely()`` and ``unlikely()`` flags, as in the Linux kernel to assist in branch prediction. On ``tcc`` and ``cl`` it has no effect. .. c:macro:: MAX_FACTORIAL_64 20 -.. c:macro:: MAX_FACTORIAL_128 34 + MAX_FACTORIAL_128 34 + .. c:macro:: PCC_SQRT_ACCURACY 8 + .. c:macro:: MAX_POW_10_16 10000U -.. c:macro:: POW_OF_MAX_POW_10_16 4 + POW_OF_MAX_POW_10_16 4 + .. c:macro:: MAX_POW_10_32 1000000000UL -.. c:macro:: POW_OF_MAX_POW_10_32 9 + POW_OF_MAX_POW_10_32 9 + .. c:macro:: MAX_POW_10_64 10000000000000000000ULL -.. c:macro:: POW_OF_MAX_POW_10_64 19 + POW_OF_MAX_POW_10_64 19 + .. c:macro:: MAX_POW_10_128 ((uintmax_t) MAX_POW_10_64 * (uintmax_t) MAX_POW_10_64) -.. c:macro:: POW_OF_MAX_POW_10_128 38 + POW_OF_MAX_POW_10_128 38 .. c:namespace-pop:: diff --git a/docs/c/math.rst b/docs/c/math.rst index 63e8b1cf..55699e78 100644 --- a/docs/c/math.rst +++ b/docs/c/math.rst @@ -27,9 +27,7 @@ math.h a hard time including ````. .. c:function:: unsigned char imprecise_log10(uintmax_t x) - -.. c:function:: double sqrt(double S) - -.. c:function:: uintmax_t ceil(double x) + double sqrt(double S) + uintmax_t ceil(double x) .. c:namespace-pop:: diff --git a/docs/c/p0002.rst b/docs/c/p0002.rst index 33b443a5..2fe3bea2 100644 --- a/docs/c/p0002.rst +++ b/docs/c/p0002.rst @@ -3,11 +3,10 @@ C Implementation of Problem 2 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 2 - :file: p0002.c +Includes +-------- -.. c:autodoc:: p0002.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `fibonacci.h <./fibonacci.html>`__ .. literalinclude:: ../../c/p0002.c :language: C diff --git a/docs/c/p0003.rst b/docs/c/p0003.rst index e2053165..8a1f68a1 100644 --- a/docs/c/p0003.rst +++ b/docs/c/p0003.rst @@ -3,11 +3,10 @@ C Implementation of Problem 3 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 3 - :file: p0003.c +Includes +-------- -.. c:autodoc:: p0003.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `primes.h <./primes.html>`__ .. literalinclude:: ../../c/p0003.c :language: C diff --git a/docs/c/p0004.rst b/docs/c/p0004.rst index 39cf43e4..e9864353 100644 --- a/docs/c/p0004.rst +++ b/docs/c/p0004.rst @@ -3,11 +3,10 @@ C Implementation of Problem 4 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 4 - :file: p0004.c +Includes +-------- -.. c:autodoc:: p0004.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `iterator.h <./digits.html>`__ .. literalinclude:: ../../c/p0004.c :language: C diff --git a/docs/c/p0005.rst b/docs/c/p0005.rst index 0ef72c88..969b7851 100644 --- a/docs/c/p0005.rst +++ b/docs/c/p0005.rst @@ -3,11 +3,11 @@ C Implementation of Problem 5 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 5 - :file: p0005.c +Includes +-------- -.. c:autodoc:: p0005.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ +- `primes.h <./primes.html>`__ .. literalinclude:: ../../c/p0005.c :language: C diff --git a/docs/c/p0006.rst b/docs/c/p0006.rst index 22b43db4..fcb11a11 100644 --- a/docs/c/p0006.rst +++ b/docs/c/p0006.rst @@ -3,12 +3,6 @@ C Implementation of Problem 6 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 1 - :file: p0006.c - -.. c:autodoc:: p0006.c - :clang: -std=c11 -DAMD_COMPILER=0 - .. literalinclude:: ../../c/p0006.c :language: C :linenos: diff --git a/docs/c/p0007.rst b/docs/c/p0007.rst index 50fbbefc..55c58c2a 100644 --- a/docs/c/p0007.rst +++ b/docs/c/p0007.rst @@ -3,11 +3,10 @@ C Implementation of Problem 7 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 7 - :file: p0007.c +Includes +-------- -.. c:autodoc:: p0007.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `primes.h <./primes.html>`__ .. literalinclude:: ../../c/p0007.c :language: C diff --git a/docs/c/p0008.rst b/docs/c/p0008.rst index f91a6103..568ae808 100644 --- a/docs/c/p0008.rst +++ b/docs/c/p0008.rst @@ -3,11 +3,10 @@ C Implementation of Problem 8 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 8 - :file: p0008.c +Includes +-------- -.. c:autodoc:: p0008.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ .. literalinclude:: ../../c/p0008.c :language: C diff --git a/docs/c/p0009.rst b/docs/c/p0009.rst index be2cddd9..151d2593 100644 --- a/docs/c/p0009.rst +++ b/docs/c/p0009.rst @@ -3,12 +3,6 @@ C Implementation of Problem 9 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 9 - :file: p0009.c - -.. c:autodoc:: p0009.c - :clang: -std=c11 -DAMD_COMPILER=0 - .. literalinclude:: ../../c/p0009.c :language: C :linenos: diff --git a/docs/c/p0010.rst b/docs/c/p0010.rst index 7056ee42..c9fcf096 100644 --- a/docs/c/p0010.rst +++ b/docs/c/p0010.rst @@ -3,11 +3,10 @@ C Implementation of Problem 10 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 10 - :file: p0010.c +Includes +-------- -.. c:autodoc:: p0010.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `primes.h <./primes.html>`__ .. literalinclude:: ../../c/p0010.c :language: C diff --git a/docs/c/p0011.rst b/docs/c/p0011.rst index 19f1d04c..365c0452 100644 --- a/docs/c/p0011.rst +++ b/docs/c/p0011.rst @@ -3,11 +3,10 @@ C Implementation of Problem 11 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 11 - :file: p0011.c +Includes +-------- -.. c:autodoc:: p0011.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ .. literalinclude:: ../../c/p0011.c :language: C diff --git a/docs/c/p0012.rst b/docs/c/p0012.rst index 54702088..53b45c0c 100644 --- a/docs/c/p0012.rst +++ b/docs/c/p0012.rst @@ -3,11 +3,14 @@ C Implementation of Problem 12 (port in progress) View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 12 - :file: p0012.c +Includes +-------- -.. c:autodoc:: p0012.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ + +.. note:: + + The port of this problem is still in progress .. literalinclude:: ../../c/p0012.c :language: C diff --git a/docs/c/p0013.rst b/docs/c/p0013.rst index 0efc677b..43500d48 100644 --- a/docs/c/p0013.rst +++ b/docs/c/p0013.rst @@ -3,11 +3,10 @@ C Implementation of Problem 13 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 13 - :file: p0013.c +Includes +-------- -.. c:autodoc:: p0013.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `bcd.h <./bcd.html>`__ .. literalinclude:: ../../c/p0013.c :language: C diff --git a/docs/c/p0014.rst b/docs/c/p0014.rst index 56fac882..1cf1c445 100644 --- a/docs/c/p0014.rst +++ b/docs/c/p0014.rst @@ -3,11 +3,10 @@ C Implementation of Problem 14 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 14 - :file: p0014.c +Includes +-------- -.. c:autodoc:: p0014.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ .. literalinclude:: ../../c/p0014.c :language: C diff --git a/docs/c/p0015.rst b/docs/c/p0015.rst index b5b0f90a..be0dc53f 100644 --- a/docs/c/p0015.rst +++ b/docs/c/p0015.rst @@ -3,11 +3,10 @@ C Implementation of Problem 15 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 15 - :file: p0015.c +Includes +-------- -.. c:autodoc:: p0015.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `math.h <./math.html>`__ .. literalinclude:: ../../c/p0015.c :language: C diff --git a/docs/c/p0016.rst b/docs/c/p0016.rst index 584c5fdf..b91e6a04 100644 --- a/docs/c/p0016.rst +++ b/docs/c/p0016.rst @@ -3,11 +3,10 @@ C Implementation of Problem 16 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 16 - :file: p0016.c +Includes +-------- -.. c:autodoc:: p0016.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `bcd.h <./bcd.html>`__ .. literalinclude:: ../../c/p0016.c :language: C diff --git a/docs/c/p0034.rst b/docs/c/p0034.rst index 8c5def4f..fd9fd538 100644 --- a/docs/c/p0034.rst +++ b/docs/c/p0034.rst @@ -3,11 +3,11 @@ C Implementation of Problem 34 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 34 - :file: p0034.c +Includes +-------- -.. c:autodoc:: p0034.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `digits.h <./digits.html>`__ +- `math.h <./math.html>`__ .. literalinclude:: ../../c/p0034.c :language: C diff --git a/docs/c/p0076.rst b/docs/c/p0076.rst index 151be5ad..8a8dc7ea 100644 --- a/docs/c/p0076.rst +++ b/docs/c/p0076.rst @@ -3,11 +3,10 @@ C Implementation of Problem 76 View source code `here on GitHub! `_ -.. c:autosection:: Project Euler Problem 76 - :file: p00076.c +Includes +-------- -.. c:autodoc:: p0076.c - :clang: -std=c11 -DAMD_COMPILER=0 +- `macros.h <./macros.html>`__ .. literalinclude:: ../../c/p0076.c :language: C diff --git a/docs/c/primes.rst b/docs/c/primes.rst index 520fa110..20bd6f88 100644 --- a/docs/c/primes.rst +++ b/docs/c/primes.rst @@ -8,7 +8,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime numbers. - .. c:member:: uintmax_t (*iterator_function)(*prime_counter) + .. c:member:: uintmax_t (*iterator_function)(*prime_counter pc) The function to advance the iterator and return the next element. @@ -35,8 +35,7 @@ primes.h .. c:member:: prime_sieve *ps .. c:function:: prime_counter prime_counter1(uintmax_t stop) - - .. c:function:: prime_counter prime_counter0() + prime_counter prime_counter0() .. c:function:: void free_prime_counter(prime_counter pc) @@ -44,7 +43,7 @@ primes.h An :c:macro:`Iterator ` that implements a modified sieve of eratosthenes - .. c:member:: uintmax_t (*iterator_function)(*prime_sieve) + .. c:member:: uintmax_t (*iterator_function)(*prime_sieve ps) The function to advance the iterator and return the next element. @@ -93,7 +92,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime factors. - .. c:member:: uintmax_t (*iterator_function)(*prime_factor_counter) + .. c:member:: uintmax_t (*iterator_function)(*prime_factor_counter pfc) The function to advance the iterator and return the next element. @@ -123,7 +122,7 @@ primes.h .. c:function:: prime_factor_counter prime_factors(uintmax_t n) - .. c:macro:: free_prime_factor_counter(pfc) + .. c:macro:: free_prime_factor_counter(pfc x) .. c:function:: uintmax_t is_composite(uintmax_t n) From 4e0a2a7792d2dcc50a9e1fc4082ec46a53ba4c0f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 21:28:28 -0500 Subject: [PATCH 213/326] Add custom rust domain, fix macro --- docs/c/primes.rst | 2 +- docs/conf.py | 15 +++++++++++++++ docs/requirements.txt | 2 +- docs/rust/p0001.rst | 2 +- docs/rust/p0002.rst | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/c/primes.rst b/docs/c/primes.rst index 20bd6f88..e313b37f 100644 --- a/docs/c/primes.rst +++ b/docs/c/primes.rst @@ -122,7 +122,7 @@ primes.h .. c:function:: prime_factor_counter prime_factors(uintmax_t n) - .. c:macro:: free_prime_factor_counter(pfc x) + .. c:macro:: free_prime_factor_counter(pfc) .. c:function:: uintmax_t is_composite(uintmax_t n) diff --git a/docs/conf.py b/docs/conf.py index 47bc70de..a62f7950 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,6 +10,8 @@ from subprocess import CalledProcessError, check_call from sys import path as sys_path +from sphinxcontrib.domaintools import custom_domain + basedir = path.abspath(path.join(path.dirname(__file__), '..')) sys_path.insert(0, basedir) sys_path.insert(0, basedir + sep + 'python') @@ -72,3 +74,16 @@ 'Problem #%s')} intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} + +def setup(app): + app.add_domain(custom_domain( + "RustDomain", + "rust", + "Rust", + { + "fn": { + }, + "var": { + }, + } + )) diff --git a/docs/requirements.txt b/docs/requirements.txt index 51d9cf5e..1ba70c05 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,4 +3,4 @@ sphinx-rtd-theme sphinx-js sphinx-csharp sphinxcontrib-makedomain -sphinx_rust +sphinxcontrib-domaintools diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index 05aa64a4..c89e8463 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:function:: p0001::p0001 +.. rust:fn:: p0001::p0001() -> int64 .. literalinclude:: ../../rust/src/p0001.rs :language: rust diff --git a/docs/rust/p0002.rst b/docs/rust/p0002.rst index b20acaa5..f2bc522b 100644 --- a/docs/rust/p0002.rst +++ b/docs/rust/p0002.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 2 View source code `here on GitHub! `_ -.. rust:function:: rust::p0002::p0002 +.. rust:fn:: p0002::p0002() -> int64 .. literalinclude:: ../../rust/src/p0002.rs :language: rust From e3aa3889b83acf5ebf01779452295b82dcf17cdf Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 21:31:35 -0500 Subject: [PATCH 214/326] remove sphinx_rust --- docs/conf.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a62f7950..9dc38ee8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,6 @@ sys_path.insert(0, basedir) sys_path.insert(0, basedir + sep + 'python') js_source_path = basedir + sep + 'javascript' -rust_crates = ["../rust"] project = 'Euler' copyright = '2024, Olivia Appleton' @@ -49,10 +48,8 @@ except Exception: IS_SILVERBLUE = False -if 'TERMUX_VERSION' not in environ: - if not IS_SILVERBLUE: - extensions.append('sphinx_js') - extensions.append('sphinx_rust') +if 'TERMUX_VERSION' not in environ and not IS_SILVERBLUE: + extensions.append('sphinx_js') templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] From ed81ac788803ea694b6c2effcc17e9312677eeef Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 21:32:33 -0500 Subject: [PATCH 215/326] remove rust comment --- .github/workflows/pages.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index bf391c51..dc18ee72 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,14 +30,6 @@ jobs: with: node-version: 22 - # - name: Use Rust stable - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - - # - name: Compile rust crate - # run: cd docs && cargo build --manifest-path ../rust/Cargo.toml - - name: Build sphinx docs run: make html From e5927df91eaf710a4e97fe727cea8ff44a5cc998 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 8 Jul 2024 18:49:12 -0500 Subject: [PATCH 216/326] style changes --- csharp/Euler/p0001.cs | 3 +++ csharp/Euler/p0002.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/csharp/Euler/p0001.cs b/csharp/Euler/p0001.cs index 0df6867e..504b19d1 100644 --- a/csharp/Euler/p0001.cs +++ b/csharp/Euler/p0001.cs @@ -23,10 +23,13 @@ public Task Answer() int answer = 0; for (int i = 0; i < 1000; i += 3) answer += i; + for (int i = 0; i < 1000; i += 5) answer += i; + for (int i = 0; i < 1000; i += 15) answer -= i; + return Task.FromResult(answer); } } diff --git a/csharp/Euler/p0002.cs b/csharp/Euler/p0002.cs index b8a9108a..502fcd9b 100644 --- a/csharp/Euler/p0002.cs +++ b/csharp/Euler/p0002.cs @@ -26,6 +26,7 @@ public Task Answer() i = 2, j = 8, tmp = 0; + while (i < 4000000) { answer += i; @@ -33,6 +34,7 @@ public Task Answer() i = j; j = tmp; } + return Task.FromResult(answer); } } From 03513b9f020319799fcc1104b2cc9d8ec6bdbf04 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 8 Jul 2024 23:15:14 -0500 Subject: [PATCH 217/326] Add partial rust prime infrastructure --- .gitignore | 3 ++- rust/src/main.rs | 19 +++++++++++++ rust/src/primes.rs | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 rust/src/primes.rs diff --git a/.gitignore b/.gitignore index fe0b1aa9..b1bcc5f4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ venv/** csharp/*/obj csharp/*/bin **/TestResults -docs/_build \ No newline at end of file +docs/_build +rust/target \ No newline at end of file diff --git a/rust/src/main.rs b/rust/src/main.rs index 35d55897..8953b578 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,5 +1,7 @@ #[cfg(test)] use std::time::Duration; +// #[cfg(test)] +// use std::iter::zip; use seq_macro::seq; #[cfg(test)] @@ -8,6 +10,7 @@ use rstest::rstest; seq!(N in 0001..=0002 { mod p~N; }); +mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); @@ -17,6 +20,10 @@ const ANSWERS: [ProblemRef; 2] = [ ]; fn main() { + // let sieve = primes::ModifiedEratosthenes::new().take(10); + // for i in sieve { + // println!("{}", i); + // } for (name, func, answer) in ANSWERS { let result = func(); println!("Problem {} should return {}. Returned {}!", name, answer, result); @@ -37,3 +44,15 @@ fn test_problem(#[case] idx: usize) -> Result<(), String> { Ok(()) } }); + + +// #[cfg(test)] +// #[test] +// fn test_primes() -> Result<(), String> { +// let primes = [2, 3, 5, 7, 11, 13, 17, 19]; +// let sieve = primes::ModifiedEratosthenes::new().take(primes.len()); +// for (p, s) in zip(primes, sieve) { +// assert_eq!(p, s); +// } +// Ok(()) +// } diff --git a/rust/src/primes.rs b/rust/src/primes.rs new file mode 100644 index 00000000..e406495a --- /dev/null +++ b/rust/src/primes.rs @@ -0,0 +1,66 @@ +use std::collections::HashMap; + +pub struct ModifiedEratosthenes { + sieve: HashMap, + prime: u64, + candidate: u64, + recurse: Option> +} + +impl ModifiedEratosthenes { + pub fn new() -> ModifiedEratosthenes { + return ModifiedEratosthenes{ + sieve: HashMap::new(), + prime: 0, + candidate: 2, + recurse: None + }; + } +} + +impl Iterator for ModifiedEratosthenes { + type Item = u64; + + fn next(&mut self) -> Option { + if self.candidate == 2 { + self.candidate = 3; + self.prime = 3; + println!("Returning 2"); + return Some(2); + } + let mut candidate = self.candidate; + self.candidate += 2; + loop { + let prime_squared = self.prime * self.prime; + println!("Candidate: {}", candidate); + let step: u64; + if self.sieve.contains_key(&candidate) { + step = self.sieve.remove(&candidate)?; + println!("Candidate in cache as {}", step); + } + else if candidate < prime_squared { + println!("Candidate not in cache, but less than {}", prime_squared); + return Some(candidate); + } + else { + if candidate != prime_squared { + panic!("Something has gone wrong in the sieve"); + } + step = self.prime * 2; + if self.recurse.is_none() { + self.recurse = Some(Box::new(ModifiedEratosthenes::new())); + let mut recursed = self.recurse.take()?; + let _ = (*recursed).next(); + } + let mut recursed = self.recurse.take()?; + self.prime = ((*recursed).next())?; + } + println!("This is the good part"); + candidate += step; + while self.sieve.contains_key(&candidate) { + candidate += step; + } + self.sieve.insert(candidate, step); + } + } +} \ No newline at end of file From 920ec6a33867d58b5df0eaf3bd9a87e1c89af616 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 8 Jul 2024 23:18:58 -0500 Subject: [PATCH 218/326] add in progress mark --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 137011b7..6f5e5877 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -94,7 +94,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-------------+-----+------+------+------+------+ | :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | +-------------+-----+------+------+------+------+ -| :prob:`3` | ✔ | | | ✔ | | +| :prob:`3` | ✔ | | | ✔ | ⏱ | +-------------+-----+------+------+------+------+ | :prob:`4` | ✔ | | | ✔ | | +-------------+-----+------+------+------+------+ From 6d1710a7608e9f43955f514ba72a4423e54f2c30 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 8 Jul 2024 23:20:43 -0500 Subject: [PATCH 219/326] more ignore patterns --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b1bcc5f4..f3abeb7d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,7 @@ csharp/*/obj csharp/*/bin **/TestResults docs/_build -rust/target \ No newline at end of file +rust/target +**/.coverage +**/.coverage.* +javascript/coverage From aa767776df63fcea8293a50c22aa4f5b46028709 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:01:29 -0500 Subject: [PATCH 220/326] Lots of doc improvements --- README.rst | 8 +- docs/c/bcd.rst | 2 +- docs/c/digits.rst | 6 +- docs/c/fibonacci.rst | 4 +- docs/c/iterator.rst | 2 +- docs/c/macros.rst | 22 +-- docs/c/primes.rst | 6 +- docs/csharp.rst | 8 +- docs/index.rst | 315 +++++++++++++++++++++++-------------------- docs/rust/p0001.rst | 2 +- docs/rust/p0002.rst | 2 +- 11 files changed, 197 insertions(+), 180 deletions(-) diff --git a/README.rst b/README.rst index e6ee1358..422a8c06 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ LivInTheLookingGlass’s Project Euler solutions ============================================== -.. |C| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg +.. |Ci| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml -.. |C#| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg +.. |C#i| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml .. |JavaScript| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml @@ -29,12 +29,12 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------------+---------------+ | Language | Version | Solved | Status | +============+=====================+==============+===============+ -| C | C11+ in: ``gcc``, | 17 / |total| | |C| | +| C | C11+ in: ``gcc``, | 17 / |total| | |Ci| | | | |br| ``clang``, | | | | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------------+---------------+ -| C# | .NET 2+ | 2 / |total| | |C#| | +| C# | .NET 2+ | 2 / |total| | |C#i| | +------------+---------------------+--------------+---------------+ | JavaScript | Node 12+ | 2 / |total| | |JavaScript| | +------------+---------------------+--------------+---------------+ diff --git a/docs/c/bcd.rst b/docs/c/bcd.rst index 2b5a7b8a..616faed7 100644 --- a/docs/c/bcd.rst +++ b/docs/c/bcd.rst @@ -40,7 +40,7 @@ It was also a good exercise in x86 assembly, as several portions are accellerate .. c:function:: BCD_int BCD_from_bytes(const unsigned char *str, size_t chars, bool negative, bool little_endian) - Takes in an arbitrary-sized encoded integer (like in Python's :external:python:ref:`int.from_bytes`) to a + Takes in an arbitrary-sized encoded integer (like in Python's :external:py:meth:`int.from_bytes`) to a :c:type:`BCD_int`. .. c:function:: BCD_int BCD_from_ascii(const char *str, size_t digits, bool negative) diff --git a/docs/c/digits.rst b/docs/c/digits.rst index bb0693ef..77e95574 100644 --- a/docs/c/digits.rst +++ b/docs/c/digits.rst @@ -8,7 +8,7 @@ digits.h Implements the :c:macro:`Iterator ` API and yields successive decimal digits of a given number. - .. c:member:: unsigned char (*iterator_function)(*digit_counter) + .. c:member:: unsigned char (*iterator_function)(digit_counter *dc) The function to advance the iterator and return the next element. @@ -32,8 +32,8 @@ digits.h This represents the current position in :c:member:`digits`. - .. c:function:: digit_counter digits(uintmax_t n) +.. c:function:: digit_counter digits(uintmax_t n) - .. c:function:: void free_digit_counter(digit_counter dc) +.. c:function:: void free_digit_counter(digit_counter dc) .. c:namespace-pop:: diff --git a/docs/c/fibonacci.rst b/docs/c/fibonacci.rst index 3db3649e..4eee4246 100644 --- a/docs/c/fibonacci.rst +++ b/docs/c/fibonacci.rst @@ -1,5 +1,5 @@ fibonacci.h -======== +=========== .. c:namespace-push:: fibonacci @@ -8,7 +8,7 @@ fibonacci.h Implements the :c:macro:`Iterator ` API and yields successive Fibonacci numbers. - .. c:member:: uintmax_t (*iterator_function)(*digit_counter) + .. c:member:: uintmax_t (*iterator_function)(fibonacci *fib) The function to advance the iterator and return the next element. diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst index 894be617..e0fbc808 100644 --- a/docs/c/iterator.rst +++ b/docs/c/iterator.rst @@ -60,7 +60,7 @@ iterator.h This is an example implementation of the :c:macro:`Iterator ` API used in this project. You can construct it using any of the factory functions found below, and it is generally used much like Python's - :external:py:ref:`range` object. + :external:py:class:`range` object. .. c:member:: uintmax_t (*iterator_function)(counter *it) diff --git a/docs/c/macros.rst b/docs/c/macros.rst index 5f6fca6a..4ade0ab9 100644 --- a/docs/c/macros.rst +++ b/docs/c/macros.rst @@ -45,21 +45,21 @@ macros.h These macros implement the ``likely()`` and ``unlikely()`` flags, as in the Linux kernel to assist in branch prediction. On ``tcc`` and ``cl`` it has no effect. -.. c:macro:: MAX_FACTORIAL_64 20 - MAX_FACTORIAL_128 34 +.. c:macro:: MAX_FACTORIAL_64 + MAX_FACTORIAL_128 -.. c:macro:: PCC_SQRT_ACCURACY 8 +.. c:macro:: PCC_SQRT_ACCURACY -.. c:macro:: MAX_POW_10_16 10000U - POW_OF_MAX_POW_10_16 4 +.. c:macro:: MAX_POW_10_16 + POW_OF_MAX_POW_10_16 -.. c:macro:: MAX_POW_10_32 1000000000UL - POW_OF_MAX_POW_10_32 9 +.. c:macro:: MAX_POW_10_32 + POW_OF_MAX_POW_10_32 -.. c:macro:: MAX_POW_10_64 10000000000000000000ULL - POW_OF_MAX_POW_10_64 19 +.. c:macro:: MAX_POW_10_64 + POW_OF_MAX_POW_10_64 -.. c:macro:: MAX_POW_10_128 ((uintmax_t) MAX_POW_10_64 * (uintmax_t) MAX_POW_10_64) - POW_OF_MAX_POW_10_128 38 +.. c:macro:: MAX_POW_10_128 + POW_OF_MAX_POW_10_128 .. c:namespace-pop:: diff --git a/docs/c/primes.rst b/docs/c/primes.rst index e313b37f..24342f73 100644 --- a/docs/c/primes.rst +++ b/docs/c/primes.rst @@ -8,7 +8,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime numbers. - .. c:member:: uintmax_t (*iterator_function)(*prime_counter pc) + .. c:member:: uintmax_t (*iterator_function)(prime_counter *pc) The function to advance the iterator and return the next element. @@ -43,7 +43,7 @@ primes.h An :c:macro:`Iterator ` that implements a modified sieve of eratosthenes - .. c:member:: uintmax_t (*iterator_function)(*prime_sieve ps) + .. c:member:: uintmax_t (*iterator_function)(prime_sieve *ps) The function to advance the iterator and return the next element. @@ -92,7 +92,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime factors. - .. c:member:: uintmax_t (*iterator_function)(*prime_factor_counter pfc) + .. c:member:: uintmax_t (*iterator_function)(prime_factor_counter *pfc) The function to advance the iterator and return the next element. diff --git a/docs/csharp.rst b/docs/csharp.rst index dd7db365..ea5ee9f3 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -14,8 +14,8 @@ Usage .. highlight:: make -This folder contains a Makefile with several recipes> -This facilitates the root Makefile dispatching tasks> +This folder contains a Makefile with several recipes, most of which are aliases to ``dotnet`` commands. +This facilitates the root Makefile dispatching tasks to each language, many of which have more complex build or test processes. .. make:target:: test @@ -28,7 +28,7 @@ build or test processes. WIP - Runs tests in parallel with one less thread than you have CPUs. Alias for ``dotnet test ``. + Runs tests in parallel with one less thread than you have CPUs. Alias for ``dotnet test``. .. make:target:: test_% @@ -36,7 +36,7 @@ build or test processes. WIP - Runs tests in parallel with the specified number of threads. Alias for ``dotnet test `. + Runs tests in parallel with the specified number of threads. Alias for ``dotnet test``. .. make:target:: clean diff --git a/docs/index.rst b/docs/index.rst index 6f5e5877..c9e3b11f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -81,155 +81,172 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` -+-------------+-----+------+------+------+------+ -| |**C**|**C#**|**Js**|**Py**|**Rs**| -+=============+=====+======+======+======+======+ -| Coverage | ✔ | ⏱ | ✔ | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| Docs | ⏱ | ✔ | ✔ | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| Linting | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`1` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`3` | ✔ | | | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| :prob:`4` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`5` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`6` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`7` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`8` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`9` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`10` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`11` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`12` | ⏱ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`13` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`14` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`15` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`16` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`17` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`18` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`19` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`20` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`21` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`22` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`23` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`24` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`25` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`27` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`29` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`30` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`31` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`32` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`33` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`34` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`35` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`36` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`37` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`38` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`39` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`40` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`41` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`42` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`43` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`44` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`45` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`46` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`47` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`48` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`49` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`50` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`52` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`53` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`55` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`56` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`57` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`59` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`67` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`69` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`71` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`73` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`74` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`76` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`77` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`87` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`92` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`97` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`118` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`123` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`134` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`145` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`187` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`206` | | | | ✔ | | -+-------------+-----+------+------+------+------+ +.. |C| replace:: **C** +.. |C#| replace:: **C#** +.. |Js| replace:: **JavaScript** +.. |Py| replace:: **Python** +.. |Rs| replace:: **Rust** +.. |d| replace:: ✔ +.. |ip| replace:: ⏱ +.. raw:: html + + + ++-----------+------+------+------+------+------+ +| | |C| | |C#| | |Js| | |Py| | |Rs| | ++===========+======+======+======+======+======+ +|Coverage | |d| | |ip| | |d| | |d| | |ip| | ++-----------+------+------+------+------+------+ +|Docs | |ip| | |d| | |d| | |d| | |ip| | ++-----------+------+------+------+------+------+ +|Linting | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|Testing | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ ++-----------+------+------+------+------+------+ +|:prob:`1` | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|:prob:`2` | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|:prob:`3` | |d| | | | |d| | |ip| | ++-----------+------+------+------+------+------+ +|:prob:`4` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`5` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`6` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`7` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`8` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`9` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`10` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`11` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`12` | |ip| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`13` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`14` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`15` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`16` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`17` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`18` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`19` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`20` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`21` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`22` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`23` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`24` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`25` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`27` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`29` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`30` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`31` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`32` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`33` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`34` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`35` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`36` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`37` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`38` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`39` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`40` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`41` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`42` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`43` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`44` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`45` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`46` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`47` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`48` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`49` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`50` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`52` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`53` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`55` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`56` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`57` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`59` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`67` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`69` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`71` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`73` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`74` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`76` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`77` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`87` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`92` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`97` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`118`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`123`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`134`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`145`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`187`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`206`| | | | |d| | | ++-----------+------+------+------+------+------+ .. toctree:: :maxdepth: 2 diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index c89e8463..dc932954 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:fn:: p0001::p0001() -> int64 +.. rust:fn:: p0001::p0001() -> u64 .. literalinclude:: ../../rust/src/p0001.rs :language: rust diff --git a/docs/rust/p0002.rst b/docs/rust/p0002.rst index f2bc522b..a39ca29b 100644 --- a/docs/rust/p0002.rst +++ b/docs/rust/p0002.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 2 View source code `here on GitHub! `_ -.. rust:fn:: p0002::p0002() -> int64 +.. rust:fn:: p0002::p0002() -> u64 .. literalinclude:: ../../rust/src/p0002.rs :language: rust From e0030292620189087029492b3b9eac929674fc6b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 10 Jul 2024 18:06:11 -0500 Subject: [PATCH 221/326] Center only one table --- docs/index.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index c9e3b11f..34f318d4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -91,10 +91,12 @@ This project is divided into several Makefiles, connected by a root Makefile whi .. raw:: html +.. rst-class:: centertable + +-----------+------+------+------+------+------+ | | |C| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+ From 2b6e2e6291f2a399320b828b6f73a3cb14fdb0e3 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 10 Jul 2024 21:45:11 -0500 Subject: [PATCH 222/326] Add help to Makefile --- Makefile | 36 +++++++++++++++++++++++++++++++++--- c/Makefile | 10 ++++++++++ csharp/Makefile | 10 ++++++++++ javascript/Makefile | 9 +++++++++ python/Makefile | 8 ++++++++ rust/Makefile | 8 ++++++++ 6 files changed, 78 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cda6b6da..94ec389a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,37 @@ PY?=python3 PROXY?= - -html dirhtml singlehtml htmlhelp qthelp devhelp epub applehelp latex man texinfo text gettext doctest linkcheck xml pseudoxml: +BLUE=\033[0;34m +NC=\033[0m # No Color + +help: + @echo "This project has a number of recipes that are delegated to other Makefiles. The following jobs are available with no prefix" + @echo " $(BLUE)clean$(NC)" + @echo " $(BLUE)html$(NC)" + @echo " $(BLUE)dirhtml$(NC)" + @echo " $(BLUE)singlehtml$(NC)" + @echo " $(BLUE)epub$(NC)" + @echo " $(BLUE)latex$(NC)" + @echo + @echo "The following jobs are available under the docs_ prefix" + @$(MAKE) docs_help $(MFLAGS) --no-print-directory + @echo + @echo "The following jobs are available under the c_ prefix" + @$(MAKE) c_help $(MFLAGS) --no-print-directory + @echo + @echo "The following jobs are available under the cs_ prefix" + @$(MAKE) cs_help $(MFLAGS) --no-print-directory + @echo + @echo "The following jobs are available under the js_ prefix" + @$(MAKE) js_help $(MFLAGS) --no-print-directory + @echo + @echo "The following jobs are available under the py_ prefix" + @$(MAKE) py_help $(MFLAGS) --no-print-directory + @echo + @echo "The following jobs are available under the rs_ prefix" + @$(MAKE) rs_help $(MFLAGS) --no-print-directory + + +html dirhtml singlehtml epub latex: @$(MAKE) docs_$@ $(MFLAGS) clean: cs_clean c_clean js_clean py_clean rs_clean docs_clean @@ -25,4 +55,4 @@ rs_%: @cd rust && $(MAKE) $* $(MFLAGS) %: - @$(MAKE) {c,cs,js,py,rs}_$* $(MFLAGS) + @$(MAKE) c_$* cs_$* js_$* py_$* rs_$* $(MFLAGS) diff --git a/c/Makefile b/c/Makefile index 3bc84e75..62ec31ba 100644 --- a/c/Makefile +++ b/c/Makefile @@ -1,6 +1,8 @@ PY?=python3 USER_FLAG?=--user PIP?=$(PY) -m pip +BLUE=\033[0;34m +NC=\033[0m # No Color ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) @@ -12,6 +14,14 @@ PROXY_ARG= endif endif +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the Python test runner infrastructure" + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it. Utilizes the Python test runner infrastructure" + @echo " $(BLUE)dependencies$(NC) initialize submodules and install any Python dependencies" + @echo " $(BLUE)lint$(NC) run clang-tidy across each of the .c and .h files" + @echo " $(BLUE)native$(NC) build a test binary utilizing the Unity test framework" + @echo " $(BLUE)clean$(NC) clean up any stray files" + test_%: dependencies cd ../python; $(MAKE) dependencies $(MFLAGS) $(PY) -m pytest -vl -n$* test_euler.py --cov diff --git a/csharp/Makefile b/csharp/Makefile index 6afad577..69919137 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,3 +1,13 @@ +BLUE=\033[0;34m +NC=\033[0m # No Color + +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the Xunit framework" + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it. Utilizes the Xunit framework" + @echo " $(BLUE)dependencies$(NC) runs dotnet restore" + @echo " $(BLUE)lint$(NC) runs dotnet format --verify-no-changes" + @echo " $(BLUE)clean$(NC) clean up any stray files" + clean: dotnet clean || rm ./*/{bin,obj,TestResults} || echo diff --git a/javascript/Makefile b/javascript/Makefile index 3dd7e0eb..627bbb58 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -7,6 +7,15 @@ MOCHA=istanbul cover ./node_modules/mocha/bin/_mocha else MOCHA=npx mocha endif +BLUE=\033[0;34m +NC=\033[0m # No Color + +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the Mocha test runner" + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it. Utilizes the Mocha test runner" + @echo " $(BLUE)dependencies$(NC) runs npm install" + @echo " $(BLUE)lint$(NC) runs eslint" + @echo " $(BLUE)clean$(NC) clean up any stray files" test: dependencies $(MOCHA) diff --git a/python/Makefile b/python/Makefile index 9cbcb972..c2582d37 100644 --- a/python/Makefile +++ b/python/Makefile @@ -38,6 +38,14 @@ else PROXY_ARG= endif endif +BLUE=\033[0;34m +NC=\033[0m # No Color + +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the pytest test runner infrastructure" + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it. Utilizes the pytest runner" + @echo " $(BLUE)dependencies$(NC) grabs all dependencies through pip" + @echo " $(BLUE)clean$(NC) clean up any stray files" test: dependencies _test $(PY) -m pytest $(pytest_args) $(benchmark_flags) diff --git a/rust/Makefile b/rust/Makefile index 2f7f3ce4..af4e8876 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -1,3 +1,11 @@ +BLUE=\033[0;34m +NC=\033[0m # No Color + +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence." + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it" + @echo " $(BLUE)clean$(NC) clean up any stray files" + test: cargo test From fc02b4c1cbcae85dfe7c6fd8480166064ae26597 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 19:32:37 -0500 Subject: [PATCH 223/326] only deploy pages on main branch --- .github/workflows/pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index dc18ee72..0a18e9a4 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -52,5 +52,6 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment + if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/master' }} uses: actions/deploy-pages@v4 From 8615339043855d9f034cc36cb531a71239a27119 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 19:36:25 -0500 Subject: [PATCH 224/326] remove removed make recipes --- docs/index.rst | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 34f318d4..fc49f5d8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,6 +28,10 @@ This project is divided into several Makefiles, connected by a root Makefile whi Removes all temporary or cache files, as well as any build artifacts .. make:target:: html +.. make:target:: dirhtml +.. make:target:: singlehtml +.. make:target:: epub +.. make:target:: latex This recipe redirects to the docs Makefile. Note that this is actually a multi-target recipe that includes any builder name supported by @@ -39,18 +43,6 @@ This project is divided into several Makefiles, connected by a root Makefile whi - ``singlehtml`` - ``epub`` - ``latex`` - - ``man`` - - ``htmlhelp`` - - ``qthelp`` - - ``devhelp`` - - ``applehelp`` - - ``texinfo`` - - ``text`` - - ``gettext`` - - ``doctest`` - - ``linkcheck`` - - ``xml`` - - ``pseudoxml`` .. make:target:: cs_% From 86a4ca331f4d07551e96e7c7a50ebb6db5538e60 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 20:25:29 -0500 Subject: [PATCH 225/326] add final prime infrastructure --- rust/Cargo.lock | 16 +++++++ rust/Cargo.toml | 1 + rust/src/main.rs | 50 ++++++++++++++-------- rust/src/primes.rs | 104 ++++++++++++++++++++++++++------------------- 4 files changed, 110 insertions(+), 61 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index f4589d10..c186ca65 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -23,6 +23,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "equivalent" version = "1.0.1" @@ -146,6 +152,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "memchr" version = "2.7.4" @@ -260,6 +275,7 @@ dependencies = [ name = "rust" version = "0.1.0" dependencies = [ + "itertools", "rstest", "seq-macro", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index d7c37765..256c37b4 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -4,5 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] +itertools = "0.13.0" rstest = "0.21.0" seq-macro = "0.3.5" diff --git a/rust/src/main.rs b/rust/src/main.rs index 8953b578..28cf7782 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,11 +1,13 @@ #[cfg(test)] use std::time::Duration; -// #[cfg(test)] -// use std::iter::zip; +#[cfg(test)] +use std::iter::zip; use seq_macro::seq; #[cfg(test)] use rstest::rstest; +#[cfg(test)] +use itertools::Itertools; seq!(N in 0001..=0002 { mod p~N; @@ -16,14 +18,15 @@ type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); const ANSWERS: [ProblemRef; 2] = [ ("p0001", p0001::p0001, 233168), - ("p0002", p0002::p0002, 4613732) + ("p0002", p0002::p0002, 4613732), +// ("p0003", p0003::p0003, 6857), ]; fn main() { - // let sieve = primes::ModifiedEratosthenes::new().take(10); - // for i in sieve { - // println!("{}", i); - // } + let sieve = primes::Eratosthenes::new().take(10); + for i in sieve { + println!("{}", i); + } for (name, func, answer) in ANSWERS { let result = func(); println!("Problem {} should return {}. Returned {}!", name, answer, result); @@ -46,13 +49,26 @@ fn test_problem(#[case] idx: usize) -> Result<(), String> { }); -// #[cfg(test)] -// #[test] -// fn test_primes() -> Result<(), String> { -// let primes = [2, 3, 5, 7, 11, 13, 17, 19]; -// let sieve = primes::ModifiedEratosthenes::new().take(primes.len()); -// for (p, s) in zip(primes, sieve) { -// assert_eq!(p, s); -// } -// Ok(()) -// } +#[cfg(test)] +#[test] +fn test_primes() -> Result<(), String> { + let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]; + let sieve = primes::Eratosthenes::new().take(primes.len()); + for (p, s) in zip(primes, sieve) { + assert_eq!(p, s); + } + Ok(()) +} + +#[cfg(test)] +#[test] +fn test_prime_factors() -> Result<(), String> { + for v in primes::Eratosthenes::new().take(15).combinations(2) { + let p = v[0]; + let s = v[1]; + for f in primes::PrimeFactors::new(p * s) { + assert!(f == p || f == s); + } + } + Ok(()) +} diff --git a/rust/src/primes.rs b/rust/src/primes.rs index e406495a..9829ae3e 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -1,66 +1,82 @@ use std::collections::HashMap; -pub struct ModifiedEratosthenes { - sieve: HashMap, +pub struct Eratosthenes { + sieve: HashMap>, prime: u64, candidate: u64, - recurse: Option> } -impl ModifiedEratosthenes { - pub fn new() -> ModifiedEratosthenes { - return ModifiedEratosthenes{ +impl Default for Eratosthenes { + fn default() -> Self { + return Eratosthenes{ sieve: HashMap::new(), prime: 0, candidate: 2, - recurse: None }; } } -impl Iterator for ModifiedEratosthenes { +impl Eratosthenes { + pub fn new() -> Eratosthenes { + return Default::default(); + } +} + +impl Iterator for Eratosthenes { type Item = u64; fn next(&mut self) -> Option { - if self.candidate == 2 { - self.candidate = 3; - self.prime = 3; - println!("Returning 2"); - return Some(2); - } - let mut candidate = self.candidate; - self.candidate += 2; - loop { - let prime_squared = self.prime * self.prime; - println!("Candidate: {}", candidate); - let step: u64; - if self.sieve.contains_key(&candidate) { - step = self.sieve.remove(&candidate)?; - println!("Candidate in cache as {}", step); - } - else if candidate < prime_squared { - println!("Candidate not in cache, but less than {}", prime_squared); - return Some(candidate); - } - else { - if candidate != prime_squared { - panic!("Something has gone wrong in the sieve"); + fn next_prime(sieve: &mut HashMap>, candidate: u64) -> u64 { + match sieve.get(&candidate) { + Some(numbers) => { + for num in numbers.to_owned() { + sieve + .entry(candidate + num) + .and_modify(|v| v.push(num)) + .or_insert_with(|| vec![num]); + } + sieve.remove(&candidate); + return next_prime(sieve, candidate + 1); } - step = self.prime * 2; - if self.recurse.is_none() { - self.recurse = Some(Box::new(ModifiedEratosthenes::new())); - let mut recursed = self.recurse.take()?; - let _ = (*recursed).next(); + None => { + sieve.insert(candidate * candidate, vec![candidate]); + return candidate; } - let mut recursed = self.recurse.take()?; - self.prime = ((*recursed).next())?; } - println!("This is the good part"); - candidate += step; - while self.sieve.contains_key(&candidate) { - candidate += step; + } + + self.prime = next_prime(&mut self.sieve, self.candidate); + self.candidate = self.prime + 1; // This number will be the next to be tested + + return Some(self.prime) + } +} + +pub struct PrimeFactors { + number: u64 +} + +impl PrimeFactors { + pub fn new(x: u64) -> PrimeFactors { + return PrimeFactors{ + number: x + }; + } +} + +impl Iterator for PrimeFactors { + type Item = u64; + + fn next(&mut self) -> Option { + for p in Eratosthenes::new() { + if self.number % p == 0 { + self.number = self.number / p; + return Some(p); + } + else if self.number < p { + break; } - self.sieve.insert(candidate, step); } + return None; } -} \ No newline at end of file +} From 499a6c825143e8889dddbff0868ed07f9b49bea0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 20:48:52 -0500 Subject: [PATCH 226/326] add limit, primes docs --- docs/conf.py | 2 ++ docs/rust.rst | 9 +++++++++ docs/rust/primes.rst | 22 ++++++++++++++++++++++ rust/src/primes.rs | 13 ++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 docs/rust/primes.rst diff --git a/docs/conf.py b/docs/conf.py index 9dc38ee8..75b35294 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -80,6 +80,8 @@ def setup(app): { "fn": { }, + "struct": { + }, "var": { }, } diff --git a/docs/rust.rst b/docs/rust.rst index 4bd7d9b4..d3108d0d 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -34,6 +34,15 @@ build or test processes. Alias for ``cargo clean``. +Library Code +------------ + +.. toctree:: + :numbered: + :maxdepth: 1 + + rust/primes + Problems Solved --------------- diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst new file mode 100644 index 00000000..57b63a7d --- /dev/null +++ b/docs/rust/primes.rst @@ -0,0 +1,22 @@ +primes.rs +========= + +View source code `here on GitHub! `_ + +.. rust:struct:: primes::Eratosthenes + + .. rust:fn:: primes::Eratosthenes::new() -> Eratosthenes + + .. rust:fn:: primes::Eratosthenes::with_limit(limit: u64) -> Eratosthenes + + .. rust:fn:: primes::Eratosthenes::next() -> Option + +.. rust:struct:: primes::PrimeFactors + + .. rust:fn:: primes::PrimeFactors::new() -> PrimeFactors + + .. rust:fn:: primes::PrimeFactors::next() -> Option + +.. literalinclude:: ../../rust/src/p0001.rs + :language: rust + :linenos: diff --git a/rust/src/primes.rs b/rust/src/primes.rs index 9829ae3e..6c537bff 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -4,6 +4,7 @@ pub struct Eratosthenes { sieve: HashMap>, prime: u64, candidate: u64, + limit: u64, } impl Default for Eratosthenes { @@ -12,6 +13,7 @@ impl Default for Eratosthenes { sieve: HashMap::new(), prime: 0, candidate: 2, + limit: u64::MAX, }; } } @@ -20,6 +22,12 @@ impl Eratosthenes { pub fn new() -> Eratosthenes { return Default::default(); } + + pub fn with_limit(limit: u64) -> Eratosthenes { + let mut ret: Eratosthenes = Default::default(); + ret.limit = limit; + return ret; + } } impl Iterator for Eratosthenes { @@ -48,7 +56,10 @@ impl Iterator for Eratosthenes { self.prime = next_prime(&mut self.sieve, self.candidate); self.candidate = self.prime + 1; // This number will be the next to be tested - return Some(self.prime) + if self.prime > self.limit { + return None; + } + return Some(self.prime); } } From 3e98e2e85e5433501236bc2651efe9f17e536f98 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 21:39:05 -0500 Subject: [PATCH 227/326] fix typo --- docs/rust/primes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst index 57b63a7d..14f294c7 100644 --- a/docs/rust/primes.rst +++ b/docs/rust/primes.rst @@ -17,6 +17,6 @@ View source code `here on GitHub! Option -.. literalinclude:: ../../rust/src/p0001.rs +.. literalinclude:: ../../rust/src/primes.rs :language: rust :linenos: From 5b93ce038656c8dc527d4f28711ec6b4af616250 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 22:33:41 -0500 Subject: [PATCH 228/326] add helper methods w/ shorter names, proper_divisors() --- docs/rust/primes.rst | 6 +++++- rust/src/main.rs | 8 ++++---- rust/src/primes.rs | 29 ++++++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst index 14f294c7..fecae4cb 100644 --- a/docs/rust/primes.rst +++ b/docs/rust/primes.rst @@ -3,6 +3,7 @@ primes.rs View source code `here on GitHub! `_ +.. rust:fn:: primes::primes() -> Eratosthenes .. rust:struct:: primes::Eratosthenes .. rust:fn:: primes::Eratosthenes::new() -> Eratosthenes @@ -11,12 +12,15 @@ View source code `here on GitHub! Option +.. rust:fn:: primes::prime_factors(x: u64 -> PrimeFactors .. rust:struct:: primes::PrimeFactors - .. rust:fn:: primes::PrimeFactors::new() -> PrimeFactors + .. rust:fn:: primes::PrimeFactors::new(x: u64) -> PrimeFactors .. rust:fn:: primes::PrimeFactors::next() -> Option +.. rust:fn:: primes::proper_divisors(x: u64) -> Vec + .. literalinclude:: ../../rust/src/primes.rs :language: rust :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 28cf7782..15222fba 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -23,7 +23,7 @@ const ANSWERS: [ProblemRef; 2] = [ ]; fn main() { - let sieve = primes::Eratosthenes::new().take(10); + let sieve = primes::primes().take(10); for i in sieve { println!("{}", i); } @@ -53,7 +53,7 @@ fn test_problem(#[case] idx: usize) -> Result<(), String> { #[test] fn test_primes() -> Result<(), String> { let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]; - let sieve = primes::Eratosthenes::new().take(primes.len()); + let sieve = primes::primes().take(primes.len()); for (p, s) in zip(primes, sieve) { assert_eq!(p, s); } @@ -63,10 +63,10 @@ fn test_primes() -> Result<(), String> { #[cfg(test)] #[test] fn test_prime_factors() -> Result<(), String> { - for v in primes::Eratosthenes::new().take(15).combinations(2) { + for v in primes::primes().take(15).combinations(2) { let p = v[0]; let s = v[1]; - for f in primes::PrimeFactors::new(p * s) { + for f in primes::prime_factors(p * s) { assert!(f == p || f == s); } } diff --git a/rust/src/primes.rs b/rust/src/primes.rs index 6c537bff..979d1084 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -1,5 +1,7 @@ use std::collections::HashMap; +use itertools::Itertools; + pub struct Eratosthenes { sieve: HashMap>, prime: u64, @@ -24,9 +26,10 @@ impl Eratosthenes { } pub fn with_limit(limit: u64) -> Eratosthenes { - let mut ret: Eratosthenes = Default::default(); - ret.limit = limit; - return ret; + return Eratosthenes{ + limit: limit, + ..Default::default() + }; } } @@ -63,6 +66,10 @@ impl Iterator for Eratosthenes { } } +pub fn primes() -> Eratosthenes { + return Eratosthenes::new(); +} + pub struct PrimeFactors { number: u64 } @@ -91,3 +98,19 @@ impl Iterator for PrimeFactors { return None; } } + +pub fn prime_factors(x: u64) -> PrimeFactors { + return PrimeFactors::new(x); +} + +pub fn proper_divisors(x: u64) -> Vec { + let mut ret: Vec = vec![]; + let factors: Vec = PrimeFactors::new(x).collect(); + ret.extend(factors.clone()); + for i in 2..(factors.len()) { + for v in factors.iter().combinations(i) { + ret.push(v.iter().fold(1, |x, &y| x * y)); + } + } + return ret; +} From e5b89349d2c06bdde88c34d147565511a9cf7cbd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:03:19 -0500 Subject: [PATCH 229/326] Add solution for problem 3 --- docs/rust/p0003.rst | 18 ++++++++++++++++++ rust/src/main.rs | 6 +++--- rust/src/p0003.rs | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 docs/rust/p0003.rst create mode 100644 rust/src/p0003.rs diff --git a/docs/rust/p0003.rst b/docs/rust/p0003.rst new file mode 100644 index 00000000..8ba385c9 --- /dev/null +++ b/docs/rust/p0003.rst @@ -0,0 +1,18 @@ +Rust Implementation of Problem 3 +================================ + +View source code `here on GitHub! `_ + +Includes +-------- + +- `primes <./primes.html>`_ + +Problem Solution +---------------- + +.. rust:fn:: p0003::p0003() -> u64 + +.. literalinclude:: ../../rust/src/p0003.rs + :language: rust + :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 15222fba..44945f2f 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,17 +9,17 @@ use rstest::rstest; #[cfg(test)] use itertools::Itertools; -seq!(N in 0001..=0002 { +seq!(N in 0001..=0003 { mod p~N; }); mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 2] = [ +const ANSWERS: [ProblemRef; 3] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), -// ("p0003", p0003::p0003, 6857), + ("p0003", p0003::p0003, 6857), ]; fn main() { diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs new file mode 100644 index 00000000..364c1e89 --- /dev/null +++ b/rust/src/p0003.rs @@ -0,0 +1,16 @@ +/* +Project Euler Problem 3 + +This problem was fun, because it let me learn how to make Iterators in rust + +Problem: + +The prime factors of 13195 are 5, 7, 13 and 29. + +What is the largest prime factor of the number 600851475143 ? +*/ +mod primes; + +pub fn p0003() -> u64 { + return primes::prime_factors(600851475143).max(); +} From 33d3ddfb187e560ab9f532e11a49410156101012 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:20:42 -0500 Subject: [PATCH 230/326] More test versions, fix import issue --- .github/workflows/rust.yml | 24 ++++++++++++++++++++---- rust/src/p0003.rs | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 48c46b9f..c8c64817 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,9 +16,9 @@ jobs: fail-fast: false matrix: toolchain: - - stable - - beta - - nightly + - nightly # currently = 1.81 + - beta # currently = 1.80 + - stable # currently = 1.79 os: - ubuntu-latest - windows-latest @@ -27,10 +27,26 @@ jobs: os: macos-13 - toolchain: stable os: macos-latest - - toolchain: "1.69" + - toolchain: "1.78" + os: ubuntu-latest + - toolchain: "1.77" + os: ubuntu-latest + - toolchain: "1.76" + os: ubuntu-latest + - toolchain: "1.75" + os: ubuntu-latest + - toolchain: "1.74" + os: ubuntu-latest + - toolchain: "1.73" + os: ubuntu-latest + - toolchain: "1.72" + os: ubuntu-latest + - toolchain: "1.71" os: ubuntu-latest - toolchain: "1.70" os: ubuntu-latest + - toolchain: "1.69" + os: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index 364c1e89..92f4a073 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -9,8 +9,8 @@ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? */ -mod primes; +use crate::primes::prime_factors; pub fn p0003() -> u64 { - return primes::prime_factors(600851475143).max(); + return prime_factors(600851475143).max(); } From 5179dda21dc06f0b3405c18cf96996da4d4c7120 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:23:21 -0500 Subject: [PATCH 231/326] Fix typing --- rust/src/p0003.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index 92f4a073..e602c2de 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,5 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> u64 { - return prime_factors(600851475143).max(); + return prime_factors(600851475143).max()?; } From 48f5ce5f876fbd4ae7230b328cbeb88aec7a5aac Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:27:09 -0500 Subject: [PATCH 232/326] Add more docs --- docs/index.rst | 2 +- docs/rust/primes.rst | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index fc49f5d8..f0160521 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -105,7 +105,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`2` | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`3` | |d| | | | |d| | |ip| | +|:prob:`3` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`4` | |d| | | | |d| | | +-----------+------+------+------+------+------+ diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst index fecae4cb..3942b833 100644 --- a/docs/rust/primes.rst +++ b/docs/rust/primes.rst @@ -4,23 +4,42 @@ primes.rs View source code `here on GitHub! `_ .. rust:fn:: primes::primes() -> Eratosthenes + + A convenience method that returns an iterator over the prime numbers. + .. rust:struct:: primes::Eratosthenes + This class implements the `Sieve of Eratosthenes `_. In general, + it will iterate over all of the prime numbers. You can also provide an optional ``limit`` argument, which will force + it to not yield any numbers above that limit. Below is a gif (courtesy of Wikipedia) that demonstrates the principle + of the sieve. + + .. image:: https://upload.wikimedia.org/wikipedia/commons/9/94/Animation_Sieve_of_Eratosth.gif + :alt: Any animated example of the Sieve of Eratosthenes + .. rust:fn:: primes::Eratosthenes::new() -> Eratosthenes .. rust:fn:: primes::Eratosthenes::with_limit(limit: u64) -> Eratosthenes .. rust:fn:: primes::Eratosthenes::next() -> Option -.. rust:fn:: primes::prime_factors(x: u64 -> PrimeFactors +.. rust:fn:: primes::prime_factors(x: u64) -> PrimeFactors + + A convenience method that returns an iterator over the prime factors of a given number. + .. rust:struct:: primes::PrimeFactors + This class will iterate over all the prime factors of a number. It *only* supports positive integers. To find the + factors of a negative number, iterate over the prime factors of its absolute value and add ``-1`` as a factor manually. + .. rust:fn:: primes::PrimeFactors::new(x: u64) -> PrimeFactors .. rust:fn:: primes::PrimeFactors::next() -> Option .. rust:fn:: primes::proper_divisors(x: u64) -> Vec + This function returns a vector of the proper divisors of a number. + .. literalinclude:: ../../rust/src/primes.rs :language: rust :linenos: From ee8c293947909b50adfbdfdf481a9a1518bd789c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:35:36 -0500 Subject: [PATCH 233/326] Attempt to correct analysis paths --- .github/workflows/rust-clippy.yml | 4 ++-- .github/workflows/rust.yml | 2 +- rust/mapping.json | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 rust/mapping.json diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index b2466821..e738996e 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -47,13 +47,13 @@ jobs: --all-features --message-format=json -- -A clippy::needless_return | - sed 's#src/#rust/src/#' | clippy-sarif| + sed 's#src/#rust/src/#' | tee ../rust-clippy-results.sarif | sarif-fmt - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v1 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: rust-clippy-results.sarif wait-for-processing: true diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c8c64817..0ca47ad4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -69,7 +69,7 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov rust + run: cargo install grcov && grcov rust --path-mapping rust/mapping.json - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} diff --git a/rust/mapping.json b/rust/mapping.json new file mode 100644 index 00000000..b62458d8 --- /dev/null +++ b/rust/mapping.json @@ -0,0 +1,3 @@ +{ + "src/": "rust/src/" +} \ No newline at end of file From fd16fea35cb8df47251388fac4f74cc36404285c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:40:27 -0500 Subject: [PATCH 234/326] Fix typing (again) --- rust/src/p0003.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index e602c2de..1a52f253 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,5 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> u64 { - return prime_factors(600851475143).max()?; + return prime_factors(600851475143).map(|&x| x?).max(); } From 753bd1eafda6069ee4645f863132e9705f93f24e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:43:59 -0500 Subject: [PATCH 235/326] Fix typing (again^2) --- rust/src/p0003.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index 1a52f253..37f88b2b 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,5 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> u64 { - return prime_factors(600851475143).map(|&x| x?).max(); + return prime_factors(600851475143).map(|x| x?).max(); } From 0aa2e1b85418cc4dd2a01540c75f8ed25e8d5307 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:55:41 -0500 Subject: [PATCH 236/326] Fix typing (again^3) --- rust/src/p0003.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index 37f88b2b..29e5ba5b 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,5 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> u64 { - return prime_factors(600851475143).map(|x| x?).max(); + return prime_factors(600851475143).max()::expect("This number has prime factors"); } From 31f32a58ec15c9d9cf098aa82bd2f8b862538830 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 11 Jul 2024 23:59:47 -0500 Subject: [PATCH 237/326] Why would you suggest using :: if you want me to use . ??? --- rust/src/p0003.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index 29e5ba5b..f459dcd5 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,5 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> u64 { - return prime_factors(600851475143).max()::expect("This number has prime factors"); + return prime_factors(600851475143).max().expect("This number has prime factors"); } From 5ac2204f8aa40e6f908f38282c9688822fc2fa07 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:15:24 -0500 Subject: [PATCH 238/326] Fix several clippy warnings --- rust/src/primes.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rust/src/primes.rs b/rust/src/primes.rs index 979d1084..d41a277c 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -27,7 +27,7 @@ impl Eratosthenes { pub fn with_limit(limit: u64) -> Eratosthenes { return Eratosthenes{ - limit: limit, + limit, ..Default::default() }; } @@ -40,7 +40,7 @@ impl Iterator for Eratosthenes { fn next_prime(sieve: &mut HashMap>, candidate: u64) -> u64 { match sieve.get(&candidate) { Some(numbers) => { - for num in numbers.to_owned() { + for num in numbers { sieve .entry(candidate + num) .and_modify(|v| v.push(num)) @@ -88,7 +88,7 @@ impl Iterator for PrimeFactors { fn next(&mut self) -> Option { for p in Eratosthenes::new() { if self.number % p == 0 { - self.number = self.number / p; + self.number /= p; return Some(p); } else if self.number < p { @@ -105,12 +105,14 @@ pub fn prime_factors(x: u64) -> PrimeFactors { pub fn proper_divisors(x: u64) -> Vec { let mut ret: Vec = vec![]; - let factors: Vec = PrimeFactors::new(x).collect(); + let factors: Vec = PrimeFactors::new(x).collect().filter_map(Option::as_ref); ret.extend(factors.clone()); for i in 2..(factors.len()) { for v in factors.iter().combinations(i) { - ret.push(v.iter().fold(1, |x, &y| x * y)); + ret.push(v.iter().product()); } } + ret.sort(); + ret.dedup(); return ret; } From 822791ae9a2e88fd52423a656e0215a39f6c6e49 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:17:55 -0500 Subject: [PATCH 239/326] Update rust general info --- README.rst | 2 +- docs/index.rst | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 422a8c06..34546f45 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.8+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.69+ | 2 / |total| | |Rust| | +| Rust | 1.69+ | 3 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index f0160521..57bab90e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -34,15 +34,8 @@ This project is divided into several Makefiles, connected by a root Makefile whi .. make:target:: latex This recipe redirects to the docs Makefile. Note that this is actually a - multi-target recipe that includes any builder name supported by + multi-target recipe that includes many builder names supported by `Sphinx `__. - Only ``html`` has guaranteed support, but currently implemented are: - - - ``html`` - - ``dirhtml`` - - ``singlehtml`` - - ``epub`` - - ``latex`` .. make:target:: cs_% @@ -92,7 +85,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ | | |C| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+ -|Coverage | |d| | |ip| | |d| | |d| | |ip| | +|Coverage | |d| | |ip| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |Docs | |ip| | |d| | |d| | |d| | |ip| | +-----------+------+------+------+------+------+ From 5c4161edf0f54b4f9aebb264516bc23d61d9623d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:19:12 -0500 Subject: [PATCH 240/326] clippy was wrong/insufficiently detailed --- rust/src/primes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/primes.rs b/rust/src/primes.rs index d41a277c..f67f44c4 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -40,7 +40,7 @@ impl Iterator for Eratosthenes { fn next_prime(sieve: &mut HashMap>, candidate: u64) -> u64 { match sieve.get(&candidate) { Some(numbers) => { - for num in numbers { + for num in numbers.to_owned() { sieve .entry(candidate + num) .and_modify(|v| v.push(num)) From b6f1f1eaae62ff8799ef1a3a980998bed73f2325 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:23:41 -0500 Subject: [PATCH 241/326] remove unnecessary filter --- rust/src/primes.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/primes.rs b/rust/src/primes.rs index f67f44c4..46284e23 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -105,11 +105,11 @@ pub fn prime_factors(x: u64) -> PrimeFactors { pub fn proper_divisors(x: u64) -> Vec { let mut ret: Vec = vec![]; - let factors: Vec = PrimeFactors::new(x).collect().filter_map(Option::as_ref); + let factors: Vec = PrimeFactors::new(x).collect(); ret.extend(factors.clone()); for i in 2..(factors.len()) { for v in factors.iter().combinations(i) { - ret.push(v.iter().product()); + ret.push(v.into_iter().product()); } } ret.sort(); From af7fce27ce660926d69165de86d10d331ed966d9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:35:06 -0500 Subject: [PATCH 242/326] Coverage not actually working --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 57bab90e..4017a4ec 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -85,7 +85,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ | | |C| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+ -|Coverage | |d| | |ip| | |d| | |d| | |d| | +|Coverage | |d| | |ip| | |d| | |d| | |ip| | +-----------+------+------+------+------+------+ |Docs | |ip| | |d| | |d| | |d| | |ip| | +-----------+------+------+------+------+------+ From b55674e842537e4df94c28b25a2ff900c007f7d6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:45:39 -0500 Subject: [PATCH 243/326] Add some other utility functions found in C solutions --- docs/rust.rst | 2 ++ docs/rust/primes.rst | 12 ++++++++++++ rust/src/main.rs | 6 +++++- rust/src/primes.rs | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/rust.rst b/docs/rust.rst index d3108d0d..1aff4006 100644 --- a/docs/rust.rst +++ b/docs/rust.rst @@ -41,6 +41,8 @@ Library Code :numbered: :maxdepth: 1 + rust/digits + rust/fibonacci rust/primes Problems Solved diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst index 3942b833..f593cfe5 100644 --- a/docs/rust/primes.rst +++ b/docs/rust/primes.rst @@ -7,6 +7,10 @@ View source code `here on GitHub! Eratosthenes + + A convenience method that returns an iterator over the prime numbers until a given limit. + .. rust:struct:: primes::Eratosthenes This class implements the `Sieve of Eratosthenes `_. In general, @@ -40,6 +44,14 @@ View source code `here on GitHub! u64 + + Returns ``0`` if the number is prime, and the smallest prime factor otherwise. + +.. rust:fn:: fn is_prime(x: u64) -> bool + + Returns ``true`` if the number is prime, and ``false`` otherwise. + .. literalinclude:: ../../rust/src/primes.rs :language: rust :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 44945f2f..c1b87bc6 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -63,10 +63,14 @@ fn test_primes() -> Result<(), String> { #[cfg(test)] #[test] fn test_prime_factors() -> Result<(), String> { - for v in primes::primes().take(15).combinations(2) { + for v in primes::primes_until(1024).combinations(2) { let p = v[0]; let s = v[1]; + assert!(prime::is_prime(p)); + assert!(prime::is_prime(s)); + assert!(prime::is_composite(p * s) != 0); for f in primes::prime_factors(p * s) { + assert!(prime::is_prime(f)); assert!(f == p || f == s); } } diff --git a/rust/src/primes.rs b/rust/src/primes.rs index 46284e23..95c9bf41 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -70,6 +70,10 @@ pub fn primes() -> Eratosthenes { return Eratosthenes::new(); } +pub fn primes_until(x: u64) -> Eratosthenes { + return Eratosthenes::with_limit(x); +} + pub struct PrimeFactors { number: u64 } @@ -116,3 +120,21 @@ pub fn proper_divisors(x: u64) -> Vec { ret.dedup(); return ret; } + +pub fn is_composite(x: u64) -> u64 { + match prime_factors(x).next() { + None => { + return 0; + } + Some(number) => { + if number == x { + return 0; + } + return number; + } + } +} + +pub fn is_prime(x: u64) -> bool { + return is_composite(x) == 0; +} From bfcb979cf6e9759035805dbfc4fbecec27afe870 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 00:49:11 -0500 Subject: [PATCH 244/326] typo --- rust/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index c1b87bc6..27881e12 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -66,11 +66,11 @@ fn test_prime_factors() -> Result<(), String> { for v in primes::primes_until(1024).combinations(2) { let p = v[0]; let s = v[1]; - assert!(prime::is_prime(p)); - assert!(prime::is_prime(s)); - assert!(prime::is_composite(p * s) != 0); + assert!(primes::is_prime(p)); + assert!(primes::is_prime(s)); + assert!(primes::is_composite(p * s) != 0); for f in primes::prime_factors(p * s) { - assert!(prime::is_prime(f)); + assert!(primes::is_prime(f)); assert!(f == p || f == s); } } From c5d3a1bcddc815896040df3086993d498ba8d05a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 01:05:07 -0500 Subject: [PATCH 245/326] add additional pypy versions --- .github/workflows/python.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 746b3b9f..deaa07c8 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -47,6 +47,10 @@ jobs: version: 3.12 - os: ubuntu-latest version: graalpy-24.0 + - os: ubuntu-latest + version: pypy3.6 + - os: ubuntu-latest + version: pypy3.7 - os: ubuntu-latest version: pypy3.8 - os: ubuntu-latest From 7674588112afd7c0ba8f9dcfef8220b07aa3396b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 01:15:12 -0500 Subject: [PATCH 246/326] attempt to still test pypy3.[67] --- .github/workflows/python.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index deaa07c8..496dc440 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -80,11 +80,18 @@ jobs: run: make py_test LINT=false benchmark_flags= - name: Run tests (in parallel) - if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy'))}} + if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy') || (matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7'))}} run: make py_test_auto LINT=false COV=true + - name: Run tests (in parallel, w/ minimum dependencies) + if: ${{(matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7')}} + run: | + sed '/pytest-[^b\n][^\n]*/d' python/requirements.txt + sed '/coverage/d' python/requirements.txt + make py_test_auto LINT=false COV=false + - name: Upload coverage reports to Codecov - if: ${{!contains(matrix.version, 'graalpy')}} + if: ${{!contains(matrix.version, 'graalpy') && matrix.version != 'pypy3.6' && matrix.version != 'pypy3.7'}} uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 4e83452baf8c15df47ee2de477efd48ea96e029d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 01:25:42 -0500 Subject: [PATCH 247/326] add forgotten inline flag --- .github/workflows/python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 496dc440..6dbf100a 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -86,8 +86,8 @@ jobs: - name: Run tests (in parallel, w/ minimum dependencies) if: ${{(matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7')}} run: | - sed '/pytest-[^b\n][^\n]*/d' python/requirements.txt - sed '/coverage/d' python/requirements.txt + sed -i '/pytest-[^b\n][^\n]*/d' python/requirements.txt + sed -i '/coverage/d' python/requirements.txt make py_test_auto LINT=false COV=false - name: Upload coverage reports to Codecov From 708edc1618b44ced22fde8426457510715859507 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 17:06:08 -0500 Subject: [PATCH 248/326] maybe parallel testing was optimistic on pypy that old --- .github/workflows/python.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 6dbf100a..97be24d7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -79,16 +79,16 @@ jobs: if: ${{contains(matrix.version, 'graalpy')}} run: make py_test LINT=false benchmark_flags= - - name: Run tests (in parallel) - if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy') || (matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7'))}} - run: make py_test_auto LINT=false COV=true - - - name: Run tests (in parallel, w/ minimum dependencies) + - name: Run tests (serially, w/ minimum dependencies) if: ${{(matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7')}} run: | sed -i '/pytest-[^b\n][^\n]*/d' python/requirements.txt sed -i '/coverage/d' python/requirements.txt - make py_test_auto LINT=false COV=false + make py_test LINT=false COV=false + + - name: Run tests (in parallel) + if: ${{!((matrix.os == 'ubuntu-latest' && matrix.version == '3.12') || contains(matrix.version, 'graalpy') || (matrix.version == 'pypy3.6') || (matrix.version == 'pypy3.7'))}} + run: make py_test_auto LINT=false COV=true - name: Upload coverage reports to Codecov if: ${{!contains(matrix.version, 'graalpy') && matrix.version != 'pypy3.6' && matrix.version != 'pypy3.7'}} From 2bec19e5c41607ab069aa654d95ef97368323e3f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 12 Jul 2024 17:50:26 -0500 Subject: [PATCH 249/326] update supported pypy version --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 34546f45..4872b9e0 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ LivInTheLookingGlass’s Project Euler solutions | JavaScript | Node 12+ | 2 / |total| | |JavaScript| | +------------+---------------------+--------------+---------------+ | Python | CPython 3.6+ |br| | 70 / |total| | |Python| | -| | Pypy 3.8+ |br| | | | +| | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ | Rust | 1.69+ | 3 / |total| | |Rust| | From 2330d42ea9a2cb2aa5c0d72304e0db2975a7190c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 13 Jul 2024 23:27:10 -0500 Subject: [PATCH 250/326] solve problem 7 in rust --- README.rst | 2 +- docs/index.rst | 2 +- docs/rust/p0007.rst | 18 ++++++++++++++++++ rust/src/main.rs | 8 +++++--- rust/src/p0007.rs | 21 +++++++++++++++++++++ 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 docs/rust/p0007.rst create mode 100644 rust/src/p0007.rs diff --git a/README.rst b/README.rst index 4872b9e0..8154b8f4 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.69+ | 3 / |total| | |Rust| | +| Rust | 1.69+ | 4 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index 4017a4ec..b85bb5ae 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -106,7 +106,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`6` | |d| | | | |d| | | +-----------+------+------+------+------+------+ -|:prob:`7` | |d| | | | |d| | | +|:prob:`7` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`8` | |d| | | | |d| | | +-----------+------+------+------+------+------+ diff --git a/docs/rust/p0007.rst b/docs/rust/p0007.rst new file mode 100644 index 00000000..07cadc55 --- /dev/null +++ b/docs/rust/p0007.rst @@ -0,0 +1,18 @@ +Rust Implementation of Problem 7 +================================ + +View source code `here on GitHub! `_ + +Includes +-------- + +- `primes <./primes.html>`_ + +Problem Solution +---------------- + +.. rust:fn:: p0007::p0007() -> u64 + +.. literalinclude:: ../../rust/src/p0007.rs + :language: rust + :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 27881e12..b20c5b81 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -12,14 +12,16 @@ use itertools::Itertools; seq!(N in 0001..=0003 { mod p~N; }); +mod p0007; mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 3] = [ +const ANSWERS: [ProblemRef; 4] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), + ("p0007", p0007::p0007, 104743), ]; fn main() { @@ -34,7 +36,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..2 { +seq!(N in 0..3 { #[rstest] #[timeout(Duration::new(60, 0))] #( @@ -63,7 +65,7 @@ fn test_primes() -> Result<(), String> { #[cfg(test)] #[test] fn test_prime_factors() -> Result<(), String> { - for v in primes::primes_until(1024).combinations(2) { + for v in primes::primes_until(256).combinations(2) { let p = v[0]; let s = v[1]; assert!(primes::is_prime(p)); diff --git a/rust/src/p0007.rs b/rust/src/p0007.rs new file mode 100644 index 00000000..dfd44759 --- /dev/null +++ b/rust/src/p0007.rs @@ -0,0 +1,21 @@ +/* +Project Euler Problem 7 + +The prime number infrastructure paid off here + +Problem: + +By listing the first six prime numbers: 2, 3, 5, 7, > + +What is the 10 001st prime number? +*/ +use crate::primes::primes; + +pub fn p0007() -> u64 { + for (i, p) in primes().enumerate() { + if i == 1001 { + return p; + } + } + return 0; +} From 26ed5d75aa152565f09a7ed76bdfae65a61361c7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 10:03:39 -0500 Subject: [PATCH 251/326] Make prime infrastructure generic --- docs/rust/primes.rst | 26 +++++++------- rust/Cargo.lock | 10 ++++++ rust/Cargo.toml | 1 + rust/src/main.rs | 6 ++-- rust/src/primes.rs | 82 ++++++++++++++++++++++++-------------------- 5 files changed, 71 insertions(+), 54 deletions(-) diff --git a/docs/rust/primes.rst b/docs/rust/primes.rst index f593cfe5..8421fe3b 100644 --- a/docs/rust/primes.rst +++ b/docs/rust/primes.rst @@ -3,15 +3,15 @@ primes.rs View source code `here on GitHub! `_ -.. rust:fn:: primes::primes() -> Eratosthenes +.. rust:fn:: primes::primes() -> Eratosthenes A convenience method that returns an iterator over the prime numbers. -.. rust:fn:: primes::primes_until(x: u64) -> Eratosthenes +.. rust:fn:: primes::primes_until(x: I) -> Eratosthenes A convenience method that returns an iterator over the prime numbers until a given limit. -.. rust:struct:: primes::Eratosthenes +.. rust:struct:: primes::Eratosthenes This class implements the `Sieve of Eratosthenes `_. In general, it will iterate over all of the prime numbers. You can also provide an optional ``limit`` argument, which will force @@ -21,34 +21,34 @@ View source code `here on GitHub! Eratosthenes + .. rust:fn:: primes::Eratosthenes::new() -> Eratosthenes - .. rust:fn:: primes::Eratosthenes::with_limit(limit: u64) -> Eratosthenes + .. rust:fn:: primes::Eratosthenes::with_limit(limit: I) -> Eratosthenes - .. rust:fn:: primes::Eratosthenes::next() -> Option + .. rust:fn:: primes::Eratosthenes::next() -> Option -.. rust:fn:: primes::prime_factors(x: u64) -> PrimeFactors +.. rust:fn:: primes::prime_factors(x: I) -> PrimeFactors A convenience method that returns an iterator over the prime factors of a given number. -.. rust:struct:: primes::PrimeFactors +.. rust:struct:: primes::PrimeFactors This class will iterate over all the prime factors of a number. It *only* supports positive integers. To find the factors of a negative number, iterate over the prime factors of its absolute value and add ``-1`` as a factor manually. - .. rust:fn:: primes::PrimeFactors::new(x: u64) -> PrimeFactors + .. rust:fn:: primes::PrimeFactors::new(x: I) -> PrimeFactors - .. rust:fn:: primes::PrimeFactors::next() -> Option + .. rust:fn:: primes::PrimeFactors::next() -> Option -.. rust:fn:: primes::proper_divisors(x: u64) -> Vec +.. rust:fn:: primes::proper_divisors(x: I) -> Vec This function returns a vector of the proper divisors of a number. -.. rust:fn:: fn is_composite(x: u64) -> u64 +.. rust:fn:: fn is_composite(x: I) -> I Returns ``0`` if the number is prime, and the smallest prime factor otherwise. -.. rust:fn:: fn is_prime(x: u64) -> bool +.. rust:fn:: fn is_prime(x: I) -> bool Returns ``true`` if the number is prime, and ``false`` otherwise. diff --git a/rust/Cargo.lock b/rust/Cargo.lock index c186ca65..8626d36d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -167,6 +167,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -276,6 +285,7 @@ name = "rust" version = "0.1.0" dependencies = [ "itertools", + "num-traits", "rstest", "seq-macro", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 256c37b4..80d80fa8 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -5,5 +5,6 @@ edition = "2021" [dependencies] itertools = "0.13.0" +num-traits = "0.2.19" rstest = "0.21.0" seq-macro = "0.3.5" diff --git a/rust/src/main.rs b/rust/src/main.rs index b20c5b81..dd576654 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -25,7 +25,7 @@ const ANSWERS: [ProblemRef; 4] = [ ]; fn main() { - let sieve = primes::primes().take(10); + let sieve = primes::primes::().take(10); for i in sieve { println!("{}", i); } @@ -55,7 +55,7 @@ fn test_problem(#[case] idx: usize) -> Result<(), String> { #[test] fn test_primes() -> Result<(), String> { let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]; - let sieve = primes::primes().take(primes.len()); + let sieve = primes::primes::().take(primes.len()); for (p, s) in zip(primes, sieve) { assert_eq!(p, s); } @@ -65,7 +65,7 @@ fn test_primes() -> Result<(), String> { #[cfg(test)] #[test] fn test_prime_factors() -> Result<(), String> { - for v in primes::primes_until(256).combinations(2) { + for v in primes::primes_until::(256).combinations(2) { let p = v[0]; let s = v[1]; assert!(primes::is_prime(p)); diff --git a/rust/src/primes.rs b/rust/src/primes.rs index 95c9bf41..4bead42f 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -1,31 +1,37 @@ use std::collections::HashMap; +use std::cmp::PartialOrd; +use std::hash::Hash; +use num_traits::NumAssign; +use num_traits::Bounded; +use num_traits::zero; +use num_traits::one; use itertools::Itertools; -pub struct Eratosthenes { - sieve: HashMap>, - prime: u64, - candidate: u64, - limit: u64, +pub struct Eratosthenes { + sieve: HashMap>, + prime: I, + candidate: I, + limit: I, } -impl Default for Eratosthenes { +impl Default for Eratosthenes { fn default() -> Self { - return Eratosthenes{ + return Eratosthenes::{ sieve: HashMap::new(), - prime: 0, - candidate: 2, - limit: u64::MAX, + prime: zero::(), + candidate: one::() + one(), + limit: I::max_value(), }; } } -impl Eratosthenes { - pub fn new() -> Eratosthenes { +impl Eratosthenes { + pub fn new() -> Eratosthenes { return Default::default(); } - pub fn with_limit(limit: u64) -> Eratosthenes { + pub fn with_limit(limit: I) -> Eratosthenes { return Eratosthenes{ limit, ..Default::default() @@ -33,11 +39,11 @@ impl Eratosthenes { } } -impl Iterator for Eratosthenes { - type Item = u64; +impl Iterator for Eratosthenes { + type Item = I; fn next(&mut self) -> Option { - fn next_prime(sieve: &mut HashMap>, candidate: u64) -> u64 { + fn next_prime(sieve: &mut HashMap>, candidate: I) -> I { match sieve.get(&candidate) { Some(numbers) => { for num in numbers.to_owned() { @@ -47,7 +53,7 @@ impl Iterator for Eratosthenes { .or_insert_with(|| vec![num]); } sieve.remove(&candidate); - return next_prime(sieve, candidate + 1); + return next_prime(sieve, candidate + one::()); } None => { sieve.insert(candidate * candidate, vec![candidate]); @@ -56,8 +62,8 @@ impl Iterator for Eratosthenes { } } - self.prime = next_prime(&mut self.sieve, self.candidate); - self.candidate = self.prime + 1; // This number will be the next to be tested + self.prime = next_prime::(&mut self.sieve, self.candidate); + self.candidate = self.prime + one(); if self.prime > self.limit { return None; @@ -66,32 +72,32 @@ impl Iterator for Eratosthenes { } } -pub fn primes() -> Eratosthenes { +pub fn primes() -> Eratosthenes { return Eratosthenes::new(); } -pub fn primes_until(x: u64) -> Eratosthenes { +pub fn primes_until(x: I) -> Eratosthenes { return Eratosthenes::with_limit(x); } -pub struct PrimeFactors { - number: u64 +pub struct PrimeFactors { + number: I } -impl PrimeFactors { - pub fn new(x: u64) -> PrimeFactors { +impl PrimeFactors { + pub fn new(x: I) -> PrimeFactors { return PrimeFactors{ number: x }; } } -impl Iterator for PrimeFactors { - type Item = u64; +impl Iterator for PrimeFactors { + type Item = I; fn next(&mut self) -> Option { for p in Eratosthenes::new() { - if self.number % p == 0 { + if self.number % p == zero() { self.number /= p; return Some(p); } @@ -103,17 +109,17 @@ impl Iterator for PrimeFactors { } } -pub fn prime_factors(x: u64) -> PrimeFactors { +pub fn prime_factors(x: I) -> PrimeFactors { return PrimeFactors::new(x); } -pub fn proper_divisors(x: u64) -> Vec { - let mut ret: Vec = vec![]; - let factors: Vec = PrimeFactors::new(x).collect(); +pub fn proper_divisors(x: I) -> Vec { + let mut ret: Vec = vec![]; + let factors: Vec = PrimeFactors::new(x).collect(); ret.extend(factors.clone()); for i in 2..(factors.len()) { for v in factors.iter().combinations(i) { - ret.push(v.into_iter().product()); + ret.push(v.into_iter().fold(one(), |x, y| x * (*y))); } } ret.sort(); @@ -121,20 +127,20 @@ pub fn proper_divisors(x: u64) -> Vec { return ret; } -pub fn is_composite(x: u64) -> u64 { +pub fn is_composite(x: I) -> I { match prime_factors(x).next() { None => { - return 0; + return zero(); } Some(number) => { if number == x { - return 0; + return zero(); } return number; } } } -pub fn is_prime(x: u64) -> bool { - return is_composite(x) == 0; +pub fn is_prime(x: I) -> bool { + return is_composite(x) == zero(); } From 452b316777cab0b90275d2780fac8d8011126fdf Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 12:29:53 -0500 Subject: [PATCH 252/326] Fix typo in main, p0007, solve p0010 --- README.rst | 2 +- docs/index.rst | 2 +- docs/rust/p0010.rst | 18 ++++++++++++++++++ rust/src/main.rs | 6 ++++-- rust/src/p0007.rs | 7 +------ rust/src/p0010.rs | 5 +++++ 6 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 docs/rust/p0010.rst create mode 100644 rust/src/p0010.rs diff --git a/README.rst b/README.rst index 8154b8f4..7a2636b4 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------------+---------------+ -| Rust | 1.69+ | 4 / |total| | |Rust| | +| Rust | 1.69+ | 5 / |total| | |Rust| | +------------+---------------------+--------------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index b85bb5ae..e0c7cfd4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -112,7 +112,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`9` | |d| | | | |d| | | +-----------+------+------+------+------+------+ -|:prob:`10` | |d| | | | |d| | | +|:prob:`10` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`11` | |d| | | | |d| | | +-----------+------+------+------+------+------+ diff --git a/docs/rust/p0010.rst b/docs/rust/p0010.rst new file mode 100644 index 00000000..d79b8ba8 --- /dev/null +++ b/docs/rust/p0010.rst @@ -0,0 +1,18 @@ +Rust Implementation of Problem 10 +================================= + +View source code `here on GitHub! `_ + +Includes +-------- + +- `primes <./primes.html>`_ + +Problem Solution +---------------- + +.. rust:fn:: p0010::p0010() -> u64 + +.. literalinclude:: ../../rust/src/p0010.rs + :language: rust + :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index dd576654..d1e35692 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -13,15 +13,17 @@ seq!(N in 0001..=0003 { mod p~N; }); mod p0007; +mod p0010; mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 4] = [ +const ANSWERS: [ProblemRef; 5] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), ("p0007", p0007::p0007, 104743), + ("p0010", p0010::p0010, 142913828922), ]; fn main() { @@ -36,7 +38,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..3 { +seq!(N in 0..=4 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0007.rs b/rust/src/p0007.rs index dfd44759..5010ca30 100644 --- a/rust/src/p0007.rs +++ b/rust/src/p0007.rs @@ -12,10 +12,5 @@ What is the 10 001st prime number? use crate::primes::primes; pub fn p0007() -> u64 { - for (i, p) in primes().enumerate() { - if i == 1001 { - return p; - } - } - return 0; + return primes().take(10001).last().unwrap(); } diff --git a/rust/src/p0010.rs b/rust/src/p0010.rs new file mode 100644 index 00000000..af2552c6 --- /dev/null +++ b/rust/src/p0010.rs @@ -0,0 +1,5 @@ +use crate::primes::primes; + +pub fn p0010() -> u64 { + return primes::().take_while(|&p| p < 2000000).sum(); +} From 7f2f097a99def3deae82518d491202370ec6e2ef Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 14:13:03 -0500 Subject: [PATCH 253/326] remove total field, as it just adds clutter --- README.rst | 55 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/README.rst b/README.rst index 7a2636b4..aa7c2ff3 100644 --- a/README.rst +++ b/README.rst @@ -24,34 +24,33 @@ LivInTheLookingGlass’s Project Euler solutions .. |br| raw:: html
-.. |total| replace:: 897 - -+------------+---------------------+--------------+---------------+ -| Language | Version | Solved | Status | -+============+=====================+==============+===============+ -| C | C11+ in: ``gcc``, | 17 / |total| | |Ci| | -| | |br| ``clang``, | | | -| | ``msvc``, |br| | | | -| | ``pcc``, ``tcc`` | | | -+------------+---------------------+--------------+---------------+ -| C# | .NET 2+ | 2 / |total| | |C#i| | -+------------+---------------------+--------------+---------------+ -| JavaScript | Node 12+ | 2 / |total| | |JavaScript| | -+------------+---------------------+--------------+---------------+ -| Python | CPython 3.6+ |br| | 70 / |total| | |Python| | -| | Pypy 3.6+ |br| | | | -| | GraalPy 23.1+ | | | -+------------+---------------------+--------------+---------------+ -| Rust | 1.69+ | 5 / |total| | |Rust| | -+------------+---------------------+--------------+---------------+ -| Documentation (in progress) | |Pages| | -+-------------------------------------------------+---------------+ -| Code Coverage (in progress) | |Coverage| | -+-------------------------------------------------+---------------+ -| Code Scanning | |CodeQL| |br| | -| | |ESLint| |br| | -| | |RustClippy| | -+-------------------------------------------------+---------------+ + ++------------+---------------------+--------+---------------+ +| Language | Version | Solved | Status | ++============+=====================+========+===============+ +| C | C11+ in: ``gcc``, | 17 | |Ci| | +| | |br| ``clang``, | | | +| | ``msvc``, |br| | | | +| | ``pcc``, ``tcc`` | | | ++------------+---------------------+--------+---------------+ +| C# | .NET 2+ | 2 | |C#i| | ++------------+---------------------+--------+---------------+ +| JavaScript | Node 12+ | 2 | |JavaScript| | ++------------+---------------------+--------+---------------+ +| Python | CPython 3.6+ |br| | 70 | |Python| | +| | Pypy 3.6+ |br| | | | +| | GraalPy 23.1+ | | | ++------------+---------------------+--------+---------------+ +| Rust | 1.69+ | 5 | |Rust| | ++------------+---------------------+--------+---------------+ +| Documentation (in progress) | |Pages| | ++-------------------------------------------+---------------+ +| Code Coverage (in progress) | |Coverage| | ++-------------------------------------------+---------------+ +y| Code Scanning | |CodeQL| |br| | +| | |ESLint| |br| | +| | |RustClippy| | ++-------------------------------------------+---------------+ .. image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graphs/icicle.svg?token=6GHBNILEHG From 328dafe6a01c101bae2b9112164d425b706415a7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 14:39:12 -0500 Subject: [PATCH 254/326] solve p0004 in rust, update documentation --- README.rst | 2 +- docs/index.rst | 2 +- docs/rust/p0003.rst | 15 ++++++--------- rust/Makefile | 4 ++-- rust/src/main.rs | 7 ++++--- rust/src/p0010.rs | 12 ++++++++++++ 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index aa7c2ff3..b0700ca9 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------+---------------+ -| Rust | 1.69+ | 5 | |Rust| | +| Rust | 1.69+ | 6 | |Rust| | +------------+---------------------+--------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index e0c7cfd4..a0fbeb89 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -100,7 +100,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`3` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`4` | |d| | | | |d| | | +|:prob:`4` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`5` | |d| | | | |d| | | +-----------+------+------+------+------+------+ diff --git a/docs/rust/p0003.rst b/docs/rust/p0003.rst index 8ba385c9..41e8f632 100644 --- a/docs/rust/p0003.rst +++ b/docs/rust/p0003.rst @@ -1,18 +1,15 @@ -Rust Implementation of Problem 3 +Rust Implementation of Problem 4 ================================ -View source code `here on GitHub! `_ - -Includes --------- - -- `primes <./primes.html>`_ +View source code `here on GitHub! `_ Problem Solution ---------------- -.. rust:fn:: p0003::p0003() -> u64 +.. rust:fn:: p0004::is_palindrome(x: u64) -> bool + +.. rust:fn:: p0004::p0004() -> u64 -.. literalinclude:: ../../rust/src/p0003.rs +.. literalinclude:: ../../rust/src/p0004.rs :language: rust :linenos: diff --git a/rust/Makefile b/rust/Makefile index af4e8876..a250bc14 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -7,10 +7,10 @@ help: @echo " $(BLUE)clean$(NC) clean up any stray files" test: - cargo test + cargo test -j 1 test_auto: - cargo test -j + cargo test -j default test_%: cargo test -j $* diff --git a/rust/src/main.rs b/rust/src/main.rs index d1e35692..7e5ec467 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,7 +9,7 @@ use rstest::rstest; #[cfg(test)] use itertools::Itertools; -seq!(N in 0001..=0003 { +seq!(N in 0001..=0004 { mod p~N; }); mod p0007; @@ -18,10 +18,11 @@ mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 5] = [ +const ANSWERS: [ProblemRef; 6] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), + ("p0004", p0004::p0004, 906609), ("p0007", p0007::p0007, 104743), ("p0010", p0010::p0010, 142913828922), ]; @@ -38,7 +39,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..=4 { +seq!(N in 0..6 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0010.rs b/rust/src/p0010.rs index af2552c6..9caaf5b4 100644 --- a/rust/src/p0010.rs +++ b/rust/src/p0010.rs @@ -1,3 +1,15 @@ +/* +Project Euler Problem 10 + +This one was also relatively easy, especially given the work I have +done on my prime number infrastructure. + +Problem: + +The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. + +Find the sum of all the primes below two million. +*/ use crate::primes::primes; pub fn p0010() -> u64 { From a55966ba555baa87920e723f070967710b02a41a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 17:28:40 -0500 Subject: [PATCH 255/326] add forgotten file, fix table --- README.rst | 2 +- rust/src/p0004.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 rust/src/p0004.rs diff --git a/README.rst b/README.rst index b0700ca9..610c9a29 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ LivInTheLookingGlass’s Project Euler solutions +-------------------------------------------+---------------+ | Code Coverage (in progress) | |Coverage| | +-------------------------------------------+---------------+ -y| Code Scanning | |CodeQL| |br| | +| Code Scanning | |CodeQL| |br| | | | |ESLint| |br| | | | |RustClippy| | +-------------------------------------------+---------------+ diff --git a/rust/src/p0004.rs b/rust/src/p0004.rs new file mode 100644 index 00000000..98e18d62 --- /dev/null +++ b/rust/src/p0004.rs @@ -0,0 +1,32 @@ +/* +Project Euler Problem 4 + +I couldn't figure out how to do this as efficiently as I would have liked. I am +SURE that there is a better way to check if a number is a palindrome, but I +could not think of one. + +Problem: + +A palindromic number reads the same both ways. The largest palindrome made from +the product of two 2-digit numbers is 9009 = 91 × 99. + +Find the largest palindrome made from the product of two 3-digit numbers. +*/ +use itertools::Itertools; + +fn is_palindrome(x: u64) -> bool { + let s = x.to_string(); + return s == s.chars().rev().collect::(); +} + +pub fn p0004() -> u64 { + let mut answer: u64 = 0; + for v in (100..1000).combinations(2) { + let p = v.into_iter().product(); + if is_palindrome(p) && p > answer { + answer = p; + } + } + return answer; +} + From 85300a708f0fff815071045fbff2dae3396e78af Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 17:58:03 -0500 Subject: [PATCH 256/326] solve problem 5 in rust --- README.rst | 2 +- docs/index.rst | 2 +- rust/src/main.rs | 7 ++++--- rust/src/p0005.rs | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 rust/src/p0005.rs diff --git a/README.rst b/README.rst index 610c9a29..e93fe0ef 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------+---------------+ -| Rust | 1.69+ | 6 | |Rust| | +| Rust | 1.69+ | 7 | |Rust| | +------------+---------------------+--------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index a0fbeb89..02b8477a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -102,7 +102,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`4` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`5` | |d| | | | |d| | | +|:prob:`5` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`6` | |d| | | | |d| | | +-----------+------+------+------+------+------+ diff --git a/rust/src/main.rs b/rust/src/main.rs index 7e5ec467..53aa4d94 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,7 +9,7 @@ use rstest::rstest; #[cfg(test)] use itertools::Itertools; -seq!(N in 0001..=0004 { +seq!(N in 0001..=0005 { mod p~N; }); mod p0007; @@ -18,11 +18,12 @@ mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 6] = [ +const ANSWERS: [ProblemRef; 7] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), ("p0004", p0004::p0004, 906609), + ("p0005", p0005::p0005, 232792560), ("p0007", p0007::p0007, 104743), ("p0010", p0010::p0010, 142913828922), ]; @@ -39,7 +40,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..6 { +seq!(N in 0..7 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0005.rs b/rust/src/p0005.rs new file mode 100644 index 00000000..0e591732 --- /dev/null +++ b/rust/src/p0005.rs @@ -0,0 +1,15 @@ +use itertools::Itertools; + +pub fn p0005() -> u64 { + let mut answer = u64::MAX; + let group = 1..=20u64; + for x in group.clone() { + for multiples in group.clone().combinations(x as usize) { + let num = multiples.into_iter().product(); + if num < answer && group.clone().all(|divisor| num % divisor == 0) { + answer = num; + } + } + } + return answer; +} From 94463a238702680a237ddfb2cbb9190669a334c1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:06:06 -0500 Subject: [PATCH 257/326] attempt to add language graph --- .github/workflows/pages.yml | 3 +++ docs/conf.py | 10 ++++++++++ docs/index.rst | 2 ++ docs/requirements.txt | 2 ++ 4 files changed, 17 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0a18e9a4..fa2fcb96 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,6 +30,9 @@ jobs: with: node-version: 22 + - name: Install Linguist + run: gem install github-linguist + - name: Build sphinx docs run: make html diff --git a/docs/conf.py b/docs/conf.py index 75b35294..dfdac261 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,6 +11,8 @@ from sys import path as sys_path from sphinxcontrib.domaintools import custom_domain +from gh import linguist +import matplotlib.pyplot as plt basedir = path.abspath(path.join(path.dirname(__file__), '..')) sys_path.insert(0, basedir) @@ -73,6 +75,13 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} def setup(app): + langs = ghl.linguist(basedir) + labels = [lang[0] for lang in langs] + sizes = [lang[1] for lang in langs] + fig, ax = plt.subplots() + ax.pie(sizes, labels=labels, autopct='%1.1f%%') + plt.savefig("languages.svg") + app.add_domain(custom_domain( "RustDomain", "rust", @@ -86,3 +95,4 @@ def setup(app): }, } )) + diff --git a/docs/index.rst b/docs/index.rst index 02b8477a..47eb3fbe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -66,6 +66,8 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` +.. image:: ./languages.svg + .. |C| replace:: **C** .. |C#| replace:: **C#** .. |Js| replace:: **JavaScript** diff --git a/docs/requirements.txt b/docs/requirements.txt index 1ba70c05..89c4baca 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,5 @@ sphinx-js sphinx-csharp sphinxcontrib-makedomain sphinxcontrib-domaintools +ghlinguist +matplotlib From ca29fc2f09d861833c5fd8cd4e9d58d12a638aa6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:07:30 -0500 Subject: [PATCH 258/326] sudo --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index fa2fcb96..30ad2b71 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -31,7 +31,7 @@ jobs: node-version: 22 - name: Install Linguist - run: gem install github-linguist + run: sudo gem install github-linguist - name: Build sphinx docs run: make html From e65838518e5ca4fd2a249981a601b4c0656fa0d8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:12:03 -0500 Subject: [PATCH 259/326] fix import name --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index dfdac261..b5f4e088 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ from sys import path as sys_path from sphinxcontrib.domaintools import custom_domain -from gh import linguist +from ghlinguist import linguist import matplotlib.pyplot as plt basedir = path.abspath(path.join(path.dirname(__file__), '..')) @@ -75,7 +75,7 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} def setup(app): - langs = ghl.linguist(basedir) + langs = linguist(basedir) labels = [lang[0] for lang in langs] sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() From 8fed4b8cbe47127676d5a5fc1017a023475dc56b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:24:47 -0500 Subject: [PATCH 260/326] make graph transparent, disable on termux --- docs/conf.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b5f4e088..0e0be04f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,8 +11,9 @@ from sys import path as sys_path from sphinxcontrib.domaintools import custom_domain -from ghlinguist import linguist -import matplotlib.pyplot as plt +if 'TERMUX_VERSION' not in environ: + from ghlinguist import linguist + import matplotlib.pyplot as plt basedir = path.abspath(path.join(path.dirname(__file__), '..')) sys_path.insert(0, basedir) @@ -75,12 +76,13 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} def setup(app): - langs = linguist(basedir) - labels = [lang[0] for lang in langs] - sizes = [lang[1] for lang in langs] - fig, ax = plt.subplots() - ax.pie(sizes, labels=labels, autopct='%1.1f%%') - plt.savefig("languages.svg") + if 'TERMUX_VERSION' not in environ: + langs = linguist(basedir) + labels = [lang[0] for lang in langs] + sizes = [lang[1] for lang in langs] + fig, ax = plt.subplots() + ax.pie(sizes, labels=labels, autopct='%1.1f%%') + plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( "RustDomain", From b3a23f48ef3b702f6a116ac73189330141f453c5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:26:43 -0500 Subject: [PATCH 261/326] move graph location --- docs/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 47eb3fbe..331105bb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,6 +12,8 @@ This repo includes solutions in the following languages: :start-line: 2 :end-before: This is the repository +.. image:: ./languages.svg + Usage ----- @@ -66,8 +68,6 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` -.. image:: ./languages.svg - .. |C| replace:: **C** .. |C#| replace:: **C#** .. |Js| replace:: **JavaScript** From 156b15256138b3e3e76182b01a21a2bf5c58aaae Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:31:48 -0500 Subject: [PATCH 262/326] add legend --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 0e0be04f..67695fb4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,6 +82,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%') + plt.legend(loc='right') plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( From 007a7442239bb3259c559fb978120f138d16cd38 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:38:18 -0500 Subject: [PATCH 263/326] adjust legend --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 67695fb4..1193101c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%') - plt.legend(loc='right') + plt.legend(title='Languages', loc='center right', bbox_to_anchor=(1, 0, 0.5, 1)) plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( From db9ee53f19cb72f15f2d8fe3281b12c1b447d5d0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 22:11:42 -0500 Subject: [PATCH 264/326] try to remove inline labels --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 1193101c..ed630ced 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -81,7 +81,7 @@ def setup(app): labels = [lang[0] for lang in langs] sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() - ax.pie(sizes, labels=labels, autopct='%1.1f%%') + ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None) plt.legend(title='Languages', loc='center right', bbox_to_anchor=(1, 0, 0.5, 1)) plt.savefig("languages.svg", transparent=True) From 3869b348793253c6bb3e016cc459974573352b58 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 22:17:21 -0500 Subject: [PATCH 265/326] move legend --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index ed630ced..0fb6713c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None) - plt.legend(title='Languages', loc='center right', bbox_to_anchor=(1, 0, 0.5, 1)) + plt.legend(title='Languages', loc='center right', bbox_to_anchor=(0.75, 0, 0.5, 1)) plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( From 57f96b68e8a00f67313637b090d146483898680f Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 01:02:57 -0500 Subject: [PATCH 266/326] Add debug step for coverage reporting --- .github/workflows/rust.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0ca47ad4..984d909f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -71,6 +71,13 @@ jobs: if: ${{ matrix.toolchain == 'nightly' }} run: cargo install grcov && grcov rust --path-mapping rust/mapping.json + - name: Setup upterm session + uses: lhotari/action-upterm@v1 + if: ${{ matrix.toolchain == 'nightly' }} + with: + wait-timeout-minutes: 5 + limit-access-to-actor: true + - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} uses: codecov/codecov-action@v4.0.1 From e6d08125ec935413db114dbe2dd2ae444e6d1142 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 01:11:07 -0500 Subject: [PATCH 267/326] Try output file argument --- .github/workflows/c.yml | 4 ++++ .github/workflows/codeql.yml | 4 ++++ .github/workflows/csharp.yml | 4 ++++ .github/workflows/eslint.yml | 4 ++++ .github/workflows/javascript.yml | 4 ++++ .github/workflows/python.yml | 4 ++++ .github/workflows/rust-clippy.yml | 4 ++++ .github/workflows/rust.yml | 18 +++++++++++------- 8 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index cb1289f0..5662f23b 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 1 * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: c-lint: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index db3a9c5a..f151724f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,6 +11,10 @@ # name: "CodeQL" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: push: branches: [ "master" ] diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 2edd0bb8..b8fb4413 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 1 * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: csharp: strategy: diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 408957e2..4d42eb6b 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -18,6 +18,10 @@ on: schedule: - cron: '27 15 * * 5' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: eslint: name: Run eslint scanning diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 9f8498dd..8072b94c 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 1 * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: javascript: strategy: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 97be24d7..f406f110 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 1 * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: # python-lint: # runs-on: ubuntu-latest diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index e738996e..749aba83 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -18,6 +18,10 @@ on: schedule: - cron: '32 21 * * 4' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: rust-clippy-analyze: name: Run rust-clippy analyzing diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 984d909f..834af38b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,6 +8,10 @@ on: env: CARGO_TERM_COLOR: always +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build_and_test: name: Rust @@ -69,14 +73,14 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov rust --path-mapping rust/mapping.json + run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -o lcov.txt - - name: Setup upterm session - uses: lhotari/action-upterm@v1 - if: ${{ matrix.toolchain == 'nightly' }} - with: - wait-timeout-minutes: 5 - limit-access-to-actor: true + # - name: Setup upterm session + # uses: lhotari/action-upterm@v1 + # if: ${{ matrix.toolchain == 'nightly' }} + # with: + # wait-timeout-minutes: 5 + # limit-access-to-actor: true - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} From af958274f7559e15b16077fe72e988efbf4b18d9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 01:13:31 -0500 Subject: [PATCH 268/326] Try installing coverage.py --- .github/workflows/rust.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 834af38b..b3ddb89c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,6 +75,9 @@ jobs: if: ${{ matrix.toolchain == 'nightly' }} run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -o lcov.txt + - name: Install coverage.py + run: sudo pip install coverage + # - name: Setup upterm session # uses: lhotari/action-upterm@v1 # if: ${{ matrix.toolchain == 'nightly' }} From 85598ab7a212d7d3b603c29ff91879729e4a0b8c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 01:17:28 -0500 Subject: [PATCH 269/326] Spam different coverage report types in hopes any of them work --- .github/workflows/rust.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b3ddb89c..255d3c84 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,10 +73,11 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -o lcov.txt + run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -t lcov,cobertura,coveralls,coveralls+ -o . - name: Install coverage.py - run: sudo pip install coverage + if: ${{ matrix.toolchain == 'nightly' }} + run: pip install coverage # - name: Setup upterm session # uses: lhotari/action-upterm@v1 From 158e279c6e4116e57ee4c712bebf546c649c69a6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 01:19:52 -0500 Subject: [PATCH 270/326] Add forgotten argument --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 255d3c84..08e8e86a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,7 +73,7 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -t lcov,cobertura,coveralls,coveralls+ -o . + run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -t lcov,cobertura,coveralls,coveralls+ -o . --token Euler - name: Install coverage.py if: ${{ matrix.toolchain == 'nightly' }} From 04114036445793121a773777e55b8fa480e25ff6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 17:48:35 -0500 Subject: [PATCH 271/326] attempt to enable c-sharp coverage, clean up rust --- .github/workflows/csharp.yml | 7 ++++++- .github/workflows/rust.yml | 15 ++------------- csharp/Makefile | 10 ++++++++-- docs/index.rst | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index b8fb4413..2d742ca2 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -39,7 +39,12 @@ jobs: run: make cs_dependencies - name: Run Tests - run: make cs_test + run: make cs_test COV=true + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} csharp-lint: runs-on: ubuntu-latest diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 08e8e86a..f3d07a9b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,7 +11,7 @@ env: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: build_and_test: name: Rust @@ -73,18 +73,7 @@ jobs: - name: rust-grcov if: ${{ matrix.toolchain == 'nightly' }} - run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -t lcov,cobertura,coveralls,coveralls+ -o . --token Euler - - - name: Install coverage.py - if: ${{ matrix.toolchain == 'nightly' }} - run: pip install coverage - - # - name: Setup upterm session - # uses: lhotari/action-upterm@v1 - # if: ${{ matrix.toolchain == 'nightly' }} - # with: - # wait-timeout-minutes: 5 - # limit-access-to-actor: true + run: cargo install grcov && grcov rust --path-mapping rust/mapping.json -t cobertura -o . - name: Upload coverage reports to Codecov if: ${{ matrix.toolchain == 'nightly' }} diff --git a/csharp/Makefile b/csharp/Makefile index 69919137..6cc042b7 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,5 +1,11 @@ BLUE=\033[0;34m NC=\033[0m # No Color +COV?=false +ifeq (COV, true) +cov_args= --collect:"XPlat Code Coverage" +else +cov_args= +endif help: @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the Xunit framework" @@ -12,10 +18,10 @@ clean: dotnet clean || rm ./*/{bin,obj,TestResults} || echo test: dependencies - dotnet test --nologo + dotnet test --nologo $(cov_args) test_%: dependencies - $(MAKE) test + $(MAKE) test $(MFLAGS) dependencies: dotnet restore diff --git a/docs/index.rst b/docs/index.rst index 331105bb..1cc86cfe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -87,9 +87,9 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ | | |C| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+ -|Coverage | |d| | |ip| | |d| | |d| | |ip| | +|Coverage | |d| | |ip| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ -|Docs | |ip| | |d| | |d| | |d| | |ip| | +|Docs | |ip| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |Linting | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ From 38f526972045356ff076ea7762e0d93ac216db64 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 18:34:22 -0500 Subject: [PATCH 272/326] move coverage results somewhere discoverable --- .github/workflows/csharp.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 2d742ca2..1eabeb4f 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -39,7 +39,9 @@ jobs: run: make cs_dependencies - name: Run Tests - run: make cs_test COV=true + run: | + make cs_test COV=true + mv csharp/TestResults/coverage.cobertura.xml ./ - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 From c4669ef50ad4f7426359878265fc5e155f3c2074 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 18:38:03 -0500 Subject: [PATCH 273/326] add debug step --- .github/workflows/csharp.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 1eabeb4f..2802e9a1 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -41,7 +41,13 @@ jobs: - name: Run Tests run: | make cs_test COV=true - mv csharp/TestResults/coverage.cobertura.xml ./ +# mv csharp/TestResults/coverage.cobertura.xml ./ + + - name: Setup upterm session + uses: lhotari/action-upterm@v1 + with: + wait-timeout-minutes: 5 + limit-access-to-actor: true - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 From ba136cc270d1f0fb2aa44fa680a5f6a316fdc42a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 18:46:51 -0500 Subject: [PATCH 274/326] fix conditional --- csharp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Makefile b/csharp/Makefile index 6cc042b7..e4a9292e 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,7 +1,7 @@ BLUE=\033[0;34m NC=\033[0m # No Color COV?=false -ifeq (COV, true) +ifeq ($(COV),true) cov_args= --collect:"XPlat Code Coverage" else cov_args= From 009eb538ac829d00e502272b4620a95962f943ae Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 18:53:40 -0500 Subject: [PATCH 275/326] attempt filename fix --- .github/workflows/csharp.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 2802e9a1..b2aadd3d 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -41,13 +41,13 @@ jobs: - name: Run Tests run: | make cs_test COV=true -# mv csharp/TestResults/coverage.cobertura.xml ./ + mv csharp/Euler.Tests/TestResults/*/coverage.cobertura.xml ./ - - name: Setup upterm session - uses: lhotari/action-upterm@v1 - with: - wait-timeout-minutes: 5 - limit-access-to-actor: true +# - name: Setup upterm session +# uses: lhotari/action-upterm@v1 +# with: +# wait-timeout-minutes: 5 +# limit-access-to-actor: true - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 From 8114db7f5cef3b0fe8d70886b82081c153f612ad Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 18:57:19 -0500 Subject: [PATCH 276/326] typo --- .github/workflows/csharp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index b2aadd3d..2cead348 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -41,7 +41,7 @@ jobs: - name: Run Tests run: | make cs_test COV=true - mv csharp/Euler.Tests/TestResults/*/coverage.cobertura.xml ./ + mv csharp/Euler.Test/TestResults/*/coverage.cobertura.xml ./ # - name: Setup upterm session # uses: lhotari/action-upterm@v1 From 1dff969b1144ebe82dba976a861ed83c8a630d5b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 21:20:08 -0500 Subject: [PATCH 277/326] adjust table, graph position --- docs/conf.py | 2 +- docs/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0fb6713c..765f92aa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None) - plt.legend(title='Languages', loc='center right', bbox_to_anchor=(0.75, 0, 0.5, 1)) + plt.legend(title='Languages', loc='center right', bbox_to_anchor=(0.8, 0, 0.5, 1)) plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( diff --git a/docs/index.rst b/docs/index.rst index 1cc86cfe..22464b58 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -87,7 +87,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ | | |C| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+ -|Coverage | |d| | |ip| | |d| | |d| | |d| | +|Coverage | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |Docs | |ip| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ From 3c8b598a1773be78cce7bee16b9b768fda6292fc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 21:24:15 -0500 Subject: [PATCH 278/326] adjust percent label distance --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 765f92aa..81a395a7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -81,8 +81,8 @@ def setup(app): labels = [lang[0] for lang in langs] sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() - ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None) - plt.legend(title='Languages', loc='center right', bbox_to_anchor=(0.8, 0, 0.5, 1)) + ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.8) + plt.legend(title='Languages', loc='center right', bbox_to_anchor=(-1, 0, 0.5, 1)) plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( From 0e48f09a2cdd92797be2cb5b9b7c81af8fc0d1b3 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 15 Jul 2024 22:12:49 -0500 Subject: [PATCH 279/326] put legened back in box --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 81a395a7..d89a8a91 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.8) - plt.legend(title='Languages', loc='center right', bbox_to_anchor=(-1, 0, 0.5, 1)) + plt.legend(title='Languages', loc='center left', bbox_to_anchor=(1, 0)) plt.savefig("languages.svg", transparent=True) app.add_domain(custom_domain( From 86657545b61d3d4ae588afd16e4252b1960001d5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 00:03:31 -0500 Subject: [PATCH 280/326] Add python beta --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index f406f110..9b82a183 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] os: [ubuntu-latest, windows-latest] exclude: - os: ubuntu-latest From 1337d87046adaf06f34cc7dddd78e50f6c479a4e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 00:07:43 -0500 Subject: [PATCH 281/326] Add favicons from Project Euler --- docs/conf.py | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d89a8a91..21ae3e6a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,6 +30,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', + 'sphinx.ext.duration', 'sphinx.ext.extlinks', 'sphinx.ext.githubpages', 'sphinx.ext.graphviz', @@ -37,6 +38,8 @@ 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.todo', + 'sphinx-favicon', + 'sphinx-notfound-page', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', @@ -65,6 +68,16 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] +favicons = [ + { + "rel": "apple-touch-icon", + "href": "https://projecteuler.net/favicons/apple-touch-icon.png", + }, + {"href": "https://projecteuler.net/favicons/favicon-32x32.png"}, + {"href": "https://projecteuler.net/favicons/favicon-16x16.png"}, + {"href": "https://projecteuler.net/favicons/favicon.ico"}, +] + # -- Options for todo extension ---------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration @@ -73,7 +86,15 @@ extlinks = {'prob': ('https://projecteuler.net/problem=%s', 'Problem #%s')} -intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), + 'matplotlib': ('https://matplotlib.org/stable/', None), + 'Sphinx': ('https://www.sphinx-doc.org/en/stable/', None), + 'sortedcontainers': ('https://grantjenks.com/docs/sortedcontainers/', None), + 'u-msgpack-python': ('https://u-msgpack-python.readthedocs.io/en/latest/', None), + 'pytest': ('https://docs.pytest.org/en/stable/', None), + 'coverage': ('https://coverage.readthedocs.io/en/latest/', None) +} def setup(app): if 'TERMUX_VERSION' not in environ: @@ -83,18 +104,18 @@ def setup(app): fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.8) plt.legend(title='Languages', loc='center left', bbox_to_anchor=(1, 0)) - plt.savefig("languages.svg", transparent=True) + plt.savefig('languages.svg', transparent=True) app.add_domain(custom_domain( - "RustDomain", - "rust", - "Rust", + 'RustDomain', + 'rust', + 'Rust', { - "fn": { + 'fn': { }, - "struct": { + 'struct': { }, - "var": { + 'var': { }, } )) From 4c8c7a80d58a48d2b75082e1af56b6cd82014f90 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 18:24:00 -0500 Subject: [PATCH 282/326] add missed requirement --- docs/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 89c4baca..9d20df3f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,3 +6,5 @@ sphinxcontrib-makedomain sphinxcontrib-domaintools ghlinguist matplotlib +sphinx-favicon +sphinx-notfound-page From fd5eedae161f3e5c3eb22b38ae2b435ecb1adc53 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 18:37:59 -0500 Subject: [PATCH 283/326] fix import (hopefully) --- docs/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 21ae3e6a..faecdcab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,4 @@ + # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: @@ -38,8 +39,8 @@ 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - 'sphinx-favicon', - 'sphinx-notfound-page', + 'sphinx_favicon', + 'sphinx_notfound_page', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', From cddab7df13443371df15d089e6174901b7ce623b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 19:01:14 -0500 Subject: [PATCH 284/326] fix import --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index faecdcab..e7dbb1bd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,7 +40,7 @@ 'sphinx.ext.mathjax', 'sphinx.ext.todo', 'sphinx_favicon', - 'sphinx_notfound_page', + 'notfound.extension', # 'breathe', # 'javasphinx', # 'sphinx_autodoc_typehints', From 807499a10aaff3de83029e74c6c34b800a9d362c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 16 Jul 2024 21:46:07 -0500 Subject: [PATCH 285/326] remove python beta --- .github/workflows/python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 9b82a183..d2f4bb84 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -8,7 +8,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: # python-lint: # runs-on: ubuntu-latest @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] + version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] exclude: - os: ubuntu-latest From 34abf3dfa9d024723a80ed35e4552850fd8b1de6 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 17 Jul 2024 21:18:12 -0500 Subject: [PATCH 286/326] Add roadmap [no ci] --- README.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e93fe0ef..8624192a 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------+---------------+ -| Code Coverage (in progress) | |Coverage| | +| Code Coverage | |Coverage| | +-------------------------------------------+---------------+ | Code Scanning | |CodeQL| |br| | | | |ESLint| |br| | @@ -83,3 +83,15 @@ Makefile will direct recipes using prefixes - All other recipes will be run for all languages For more information, please see the README documents in each section. + +Roadmap +------- + +1. Make sure no language is below Makefile in code percentage +2. Create a C++ section + a. Make stubs for test code + b. Port C infrastructure to C++ + c. Write minimal documentation + d. Port problems 1-n, until higher than Makefile percentage +3. Repeat step 1 +4. Create a Ruby section From 8a58d06dbdd23db4a53685bbeb7902eb5e353467 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 17 Jul 2024 21:43:42 -0500 Subject: [PATCH 287/326] solve p0006 in rust --- README.rst | 2 +- docs/index.rst | 2 +- rust/src/main.rs | 8 ++++---- rust/src/p0006.rs | 28 ++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 rust/src/p0006.rs diff --git a/README.rst b/README.rst index 8624192a..ca54121c 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------+---------------+ -| Rust | 1.69+ | 7 | |Rust| | +| Rust | 1.69+ | 8 | |Rust| | +------------+---------------------+--------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------+---------------+ diff --git a/docs/index.rst b/docs/index.rst index 22464b58..ef0065c8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -106,7 +106,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`5` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`6` | |d| | | | |d| | | +|:prob:`6` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`7` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ diff --git a/rust/src/main.rs b/rust/src/main.rs index 53aa4d94..03105e4a 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,21 +9,21 @@ use rstest::rstest; #[cfg(test)] use itertools::Itertools; -seq!(N in 0001..=0005 { +seq!(N in 0001..=0007 { mod p~N; }); -mod p0007; mod p0010; mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 7] = [ +const ANSWERS: [ProblemRef; 8] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), ("p0004", p0004::p0004, 906609), ("p0005", p0005::p0005, 232792560), + ("p0006", p0006::p0006, 25164150), ("p0007", p0007::p0007, 104743), ("p0010", p0010::p0010, 142913828922), ]; @@ -40,7 +40,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..7 { +seq!(N in 0..8 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0006.rs b/rust/src/p0006.rs new file mode 100644 index 00000000..adc4d04a --- /dev/null +++ b/rust/src/p0006.rs @@ -0,0 +1,28 @@ +/* +Project Euler Problem 6 + +This turned out to be really easy + +Problem: + +The sum of the squares of the first ten natural numbers is, +1**2 + 2**2 + ... + 10**2 = 385 + +The square of the sum of the first ten natural numbers is, +(1 + 2 + ... + 10)**2 = 55**2 = 3025 + +Hence the difference between the sum of the squares of the first ten natural +numbers and the square of the sum is 3025 − 385 = 2640. + +Find the difference between the sum of the squares of the first one hundred +natural numbers and the square of the sum. +*/ + + +pub fn p0006() -> u64 { + let group = 1..101; + let sum_of_squares = group.clone().fold(0, |x, y| x + y * y); + let sum: u64 = group.sum(); + let square_of_sum = sum * sum; + return square_of_sum - sum_of_squares; +} From 3637e3efa600c994f97ca26c0346ffb0cd4d772e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Wed, 17 Jul 2024 22:46:12 -0500 Subject: [PATCH 288/326] Add docs for new rust solutions --- docs/rust/p0003.rst | 15 +++++++++------ docs/rust/p0004.rst | 15 +++++++++++++++ docs/rust/p0005.rst | 13 +++++++++++++ docs/rust/p0006.rst | 13 +++++++++++++ rust/src/p0005.rs | 15 +++++++++++++++ 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 docs/rust/p0004.rst create mode 100644 docs/rust/p0005.rst create mode 100644 docs/rust/p0006.rst diff --git a/docs/rust/p0003.rst b/docs/rust/p0003.rst index 41e8f632..8ba385c9 100644 --- a/docs/rust/p0003.rst +++ b/docs/rust/p0003.rst @@ -1,15 +1,18 @@ -Rust Implementation of Problem 4 +Rust Implementation of Problem 3 ================================ -View source code `here on GitHub! `_ +View source code `here on GitHub! `_ + +Includes +-------- + +- `primes <./primes.html>`_ Problem Solution ---------------- -.. rust:fn:: p0004::is_palindrome(x: u64) -> bool - -.. rust:fn:: p0004::p0004() -> u64 +.. rust:fn:: p0003::p0003() -> u64 -.. literalinclude:: ../../rust/src/p0004.rs +.. literalinclude:: ../../rust/src/p0003.rs :language: rust :linenos: diff --git a/docs/rust/p0004.rst b/docs/rust/p0004.rst new file mode 100644 index 00000000..41e8f632 --- /dev/null +++ b/docs/rust/p0004.rst @@ -0,0 +1,15 @@ +Rust Implementation of Problem 4 +================================ + +View source code `here on GitHub! `_ + +Problem Solution +---------------- + +.. rust:fn:: p0004::is_palindrome(x: u64) -> bool + +.. rust:fn:: p0004::p0004() -> u64 + +.. literalinclude:: ../../rust/src/p0004.rs + :language: rust + :linenos: diff --git a/docs/rust/p0005.rst b/docs/rust/p0005.rst new file mode 100644 index 00000000..1ab688c2 --- /dev/null +++ b/docs/rust/p0005.rst @@ -0,0 +1,13 @@ +Rust Implementation of Problem 5 +================================ + +View source code `here on GitHub! `_ + +Problem Solution +---------------- + +.. rust:fn:: p0005::p0005() -> u64 + +.. literalinclude:: ../../rust/src/p0005.rs + :language: rust + :linenos: diff --git a/docs/rust/p0006.rst b/docs/rust/p0006.rst new file mode 100644 index 00000000..ce026733 --- /dev/null +++ b/docs/rust/p0006.rst @@ -0,0 +1,13 @@ +Rust Implementation of Problem 6 +================================ + +View source code `here on GitHub! `_ + +Problem Solution +---------------- + +.. rust:fn:: p0006::p0006() -> u64 + +.. literalinclude:: ../../rust/src/p0006.rs + :language: rust + :linenos: diff --git a/rust/src/p0005.rs b/rust/src/p0005.rs index 0e591732..1d96f2c1 100644 --- a/rust/src/p0005.rs +++ b/rust/src/p0005.rs @@ -1,3 +1,18 @@ +/* +Project Euler Problem 5 + +I solved this problem by testing all combinations of the various multiples. I +actually tried to solve this by hand before doing this, and it wasn't terribly +hard. The answer turns out to be (2**4 * 3**2 * 5 * 7 * 11 * 13 * 17 * 19) + +Problem: + +2520 is the smallest number that can be divided by each of the numbers from 1 +to 10 without any remainder. + +What is the smallest positive number that is evenly divisible by all of the +numbers from 1 to 20? +*/ use itertools::Itertools; pub fn p0005() -> u64 { From 44a0b7f12f35949ac3b016c7ddfea15c7e835bc9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:02:03 -0500 Subject: [PATCH 289/326] Solve problems 8, 9 in rust --- docs/index.rst | 4 +-- docs/rust/p0008.rst | 13 ++++++++ docs/rust/p0009.rst | 13 ++++++++ rust/src/main.rs | 9 +++--- rust/src/p0008.rs | 73 +++++++++++++++++++++++++++++++++++++++++++++ rust/src/p0009.rs | 32 ++++++++++++++++++++ 6 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 docs/rust/p0008.rst create mode 100644 docs/rust/p0009.rst create mode 100644 rust/src/p0008.rs create mode 100644 rust/src/p0009.rs diff --git a/docs/index.rst b/docs/index.rst index ef0065c8..0f03da63 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -110,9 +110,9 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`7` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`8` | |d| | | | |d| | | +|:prob:`8` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`9` | |d| | | | |d| | | +|:prob:`9` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`10` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ diff --git a/docs/rust/p0008.rst b/docs/rust/p0008.rst new file mode 100644 index 00000000..73315191 --- /dev/null +++ b/docs/rust/p0008.rst @@ -0,0 +1,13 @@ +Rust Implementation of Problem 8 +================================ + +View source code `here on GitHub! `_ + +Problem Solution +---------------- + +.. rust:fn:: p0008::p0008() -> u64 + +.. literalinclude:: ../../rust/src/p0008.rs + :language: rust + :linenos: diff --git a/docs/rust/p0009.rst b/docs/rust/p0009.rst new file mode 100644 index 00000000..dbe0957e --- /dev/null +++ b/docs/rust/p0009.rst @@ -0,0 +1,13 @@ +Rust Implementation of Problem 9 +================================ + +View source code `here on GitHub! `_ + +Problem Solution +---------------- + +.. rust:fn:: p0009::p0009() -> u64 + +.. literalinclude:: ../../rust/src/p0009.rs + :language: rust + :linenos: diff --git a/rust/src/main.rs b/rust/src/main.rs index 03105e4a..dc92f6dc 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -9,15 +9,14 @@ use rstest::rstest; #[cfg(test)] use itertools::Itertools; -seq!(N in 0001..=0007 { +seq!(N in 0001..=0010 { mod p~N; }); -mod p0010; mod primes; type ProblemType = fn() -> u64; type ProblemRef<'a> = (&'a str, ProblemType, u64); -const ANSWERS: [ProblemRef; 8] = [ +const ANSWERS: [ProblemRef; 10] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), ("p0003", p0003::p0003, 6857), @@ -25,6 +24,8 @@ const ANSWERS: [ProblemRef; 8] = [ ("p0005", p0005::p0005, 232792560), ("p0006", p0006::p0006, 25164150), ("p0007", p0007::p0007, 104743), + ("p0008", p0008::p0008, 23514624000), + ("p0009", p0009::p0009, 31875000), ("p0010", p0010::p0010, 142913828922), ]; @@ -40,7 +41,7 @@ fn main() { } #[cfg(test)] -seq!(N in 0..8 { +seq!(N in 0..10 { #[rstest] #[timeout(Duration::new(60, 0))] #( diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs new file mode 100644 index 00000000..5c02cdbe --- /dev/null +++ b/rust/src/p0008.rs @@ -0,0 +1,73 @@ +/* +Project Euler Problem 8 + +In Python I did this with an iterator, but that is more cumbersome here, +so I just did it with a loop that slices. + +Problem: + +The four adjacent digits in the 1000-digit number that have the greatest +product are 9 × 9 × 8 × 9 = 5832. + +73167176531330624919225119674426574742355349194934 +96983520312774506326239578318016984801869478851843 +85861560789112949495459501737958331952853208805511 +12540698747158523863050715693290963295227443043557 +66896648950445244523161731856403098711121722383113 +62229893423380308135336276614282806444486645238749 +30358907296290491560440772390713810515859307960866 +70172427121883998797908792274921901699720888093776 +65727333001053367881220235421809751254540594752243 +52584907711670556013604839586446706324415722155397 +53697817977846174064955149290862569321978468622482 +83972241375657056057490261407972968652414535100474 +82166370484403199890008895243450658541227588666881 +16427171479924442928230863465674813919123162824586 +17866458359124566529476545682848912883142607690042 +24219022671055626321111109370544217506941658960408 +07198403850962455444362981230987879927244284909188 +84580156166097919133875499200524063689912560717606 +05886116467109405077541002256983155200055935729725 +71636269561882670428252483600823257530420752963450 + +Find the thirteen adjacent digits in the 1000-digit number that have the +greatest product. What is the value of this product? +*/ + + +pub fn p0008() -> u64 { + let string = concat!( + "73167176531330624919225119674426574742355349194934", + "96983520312774506326239578318016984801869478851843", + "85861560789112949495459501737958331952853208805511", + "12540698747158523863050715693290963295227443043557", + "66896648950445244523161731856403098711121722383113", + "62229893423380308135336276614282806444486645238749", + "30358907296290491560440772390713810515859307960866", + "70172427121883998797908792274921901699720888093776", + "65727333001053367881220235421809751254540594752243", + "52584907711670556013604839586446706324415722155397", + "53697817977846174064955149290862569321978468622482", + "83972241375657056057490261407972968652414535100474", + "82166370484403199890008895243450658541227588666881", + "16427171479924442928230863465674813919123162824586", + "17866458359124566529476545682848912883142607690042", + "24219022671055626321111109370544217506941658960408", + "07198403850962455444362981230987879927244284909188", + "84580156166097919133875499200524063689912560717606", + "05886116467109405077541002256983155200055935729725", + "71636269561882670428252483600823257530420752963450" + ); + let mut answer: u64 = 0; + for i in 0..(string.len() - 13) { + let slice = &string[i..(i + 13)]; + let mut prod: u64 = 1; + for c in slice.bytes() { + prod *= (c - '0' as u8) as u64; + } + if prod > answer { + answer = prod; + } + } + return answer; +} diff --git a/rust/src/p0009.rs b/rust/src/p0009.rs new file mode 100644 index 00000000..514e2ae9 --- /dev/null +++ b/rust/src/p0009.rs @@ -0,0 +1,32 @@ +/* +Project Euler Problem 9 + + + +Problem: + +A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, +a**2 + b**2 = c**2 + +For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. + +There exists exactly one Pythagorean triplet for which a + b + c = 1000. +Find the product abc. +*/ +const MAX = 500; + +pub fn p0009() -> u64 { + for c in 3..MAX { + let c_square = c * c; + for b in 2..c { + let b_square = b * b; + for a in 1..b { + let a_square = a * a; + if a_square + b_square == c_square && a + b + c == 1000 { + return a * b * c; + } + } + } + } + return 0; +} From 4c1cf35b54b83ed003375fbdd8fcbb708065b716 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:06:25 -0500 Subject: [PATCH 290/326] Update count --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ca54121c..e36b62c6 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ LivInTheLookingGlass’s Project Euler solutions | | Pypy 3.6+ |br| | | | | | GraalPy 23.1+ | | | +------------+---------------------+--------+---------------+ -| Rust | 1.69+ | 8 | |Rust| | +| Rust | 1.69+ | 10 | |Rust| | +------------+---------------------+--------+---------------+ | Documentation (in progress) | |Pages| | +-------------------------------------------+---------------+ From 96b12f3299ed973409e5d1f8216d03d5518a825c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:07:14 -0500 Subject: [PATCH 291/326] Add type info --- rust/src/p0009.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0009.rs b/rust/src/p0009.rs index 514e2ae9..a315574a 100644 --- a/rust/src/p0009.rs +++ b/rust/src/p0009.rs @@ -13,7 +13,7 @@ For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ -const MAX = 500; +const MAX: u64 = 500; pub fn p0009() -> u64 { for c in 3..MAX { From e7c3b9c2ae6a346dbbf22908c4f891d2ddfd24dd Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:23:14 -0500 Subject: [PATCH 292/326] Attempt legend placement fix --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e7dbb1bd..de05425d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -103,8 +103,8 @@ def setup(app): labels = [lang[0] for lang in langs] sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() - ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.8) - plt.legend(title='Languages', loc='center left', bbox_to_anchor=(1, 0)) + ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) + plt.legend(title='Languages', loc='bottom') plt.savefig('languages.svg', transparent=True) app.add_domain(custom_domain( From 71b428e77200b8fad7d9a6b4deac60a21599659e Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:25:40 -0500 Subject: [PATCH 293/326] Don't run tests if only docs change --- .github/workflows/c.yml | 3 +++ .github/workflows/codeql.yml | 3 +++ .github/workflows/csharp.yml | 3 +++ .github/workflows/eslint.yml | 3 +++ .github/workflows/javascript.yml | 3 +++ .github/workflows/python.yml | 3 +++ .github/workflows/rust-clippy.yml | 3 +++ .github/workflows/rust.yml | 3 +++ 8 files changed, 24 insertions(+) diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 5662f23b..9e733a46 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -2,6 +2,9 @@ name: C on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f151724f..f3409efb 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,6 +17,9 @@ concurrency: on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' branches: [ "master" ] pull_request: branches: [ "master" ] diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 2cead348..2de452a6 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -2,6 +2,9 @@ name: C# on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 4d42eb6b..002e015b 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -11,6 +11,9 @@ name: ESLint on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' branches: [ "master" ] pull_request: # The branches below must be a subset of the branches above diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 8072b94c..f6b918e4 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -2,6 +2,9 @@ name: JS on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index d2f4bb84..52c69b1c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,6 +2,9 @@ name: Py on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 749aba83..2fa6b8af 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -11,6 +11,9 @@ name: Rust-Clippy on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' branches: [ "master" ] pull_request: # The branches below must be a subset of the branches above diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f3d07a9b..42a12a9e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,6 +2,9 @@ name: Rs on: push: + paths-ignore: + - 'docs/**' + - 'README.rst' schedule: - cron: "0 0 1 * *" From a4aefd35af572713188165ef6b637ef419c93757 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:28:25 -0500 Subject: [PATCH 294/326] Change type of c --- rust/src/p0008.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index 5c02cdbe..5852cf1b 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -62,8 +62,8 @@ pub fn p0008() -> u64 { for i in 0..(string.len() - 13) { let slice = &string[i..(i + 13)]; let mut prod: u64 = 1; - for c in slice.bytes() { - prod *= (c - '0' as u8) as u64; + for c in slice.chars() { + prod *= (c - '0') as u64; } if prod > answer { answer = prod; From 4ba57564f26f90297f308e9a2cc7832644b0ffcc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:31:23 -0500 Subject: [PATCH 295/326] Correct location --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index de05425d..ed0e2187 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -104,7 +104,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) - plt.legend(title='Languages', loc='bottom') + plt.legend(title='Languages', loc='lower center') plt.savefig('languages.svg', transparent=True) app.add_domain(custom_domain( From 58b1076570f47a67cb391cada4230146ca567295 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:33:39 -0500 Subject: [PATCH 296/326] Correct type to not truncate info or raise errors --- rust/src/p0008.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index 5852cf1b..2c582811 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -62,8 +62,8 @@ pub fn p0008() -> u64 { for i in 0..(string.len() - 13) { let slice = &string[i..(i + 13)]; let mut prod: u64 = 1; - for c in slice.chars() { - prod *= (c - '0') as u64; + for c in slice.bytes() { + prod *= (c as u32 - '0' as u32) as u64; } if prod > answer { answer = prod; From 6bcbe7c655ca3013d1a7a1147cb0246fe87103b0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:53:26 -0500 Subject: [PATCH 297/326] Let's try that relocation again --- docs/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ed0e2187..e358f584 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -103,9 +103,9 @@ def setup(app): labels = [lang[0] for lang in langs] sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() - ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) - plt.legend(title='Languages', loc='lower center') - plt.savefig('languages.svg', transparent=True) + pie = ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) + plt.legend(title='Languages', loc='right') + plt.savefig('languages.svg', transparent=True, bbox_inches='tight') app.add_domain(custom_domain( 'RustDomain', From 5da15c38d14ca832a6920ed7a05ac5b7b9d19d39 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:58:43 -0500 Subject: [PATCH 298/326] Let's try that relocation again^2 --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index e358f584..ff74f2ee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -104,7 +104,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() pie = ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) - plt.legend(title='Languages', loc='right') + plt.legend(title='Languages', loc='right', bbox_to_anchor=(1,0.5)) plt.savefig('languages.svg', transparent=True, bbox_inches='tight') app.add_domain(custom_domain( From 6df28b3224506ec54556cd6374061507246d2a35 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:02:11 -0500 Subject: [PATCH 299/326] Let's try that relocation again^3 --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index ff74f2ee..653fe152 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -104,7 +104,7 @@ def setup(app): sizes = [lang[1] for lang in langs] fig, ax = plt.subplots() pie = ax.pie(sizes, labels=labels, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85) - plt.legend(title='Languages', loc='right', bbox_to_anchor=(1,0.5)) + plt.legend(title='Languages', loc='right', bbox_to_anchor=(1,0.5), bbox_transform=plt.gcf().transFigure) plt.savefig('languages.svg', transparent=True, bbox_inches='tight') app.add_domain(custom_domain( From 395b958c7b44c9ddd8031f0118c30e6fead5bfc7 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:06:28 -0500 Subject: [PATCH 300/326] Add titles for figures --- README.rst | 3 +++ docs/index.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.rst b/README.rst index e36b62c6..cf6a1286 100644 --- a/README.rst +++ b/README.rst @@ -52,6 +52,9 @@ LivInTheLookingGlass’s Project Euler solutions | | |RustClippy| | +-------------------------------------------+---------------+ +Coverage +-------- + .. image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graphs/icicle.svg?token=6GHBNILEHG This is the repository I keep for prospective employers to look at diff --git a/docs/index.rst b/docs/index.rst index 0f03da63..31eb86cd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,6 +12,9 @@ This repo includes solutions in the following languages: :start-line: 2 :end-before: This is the repository +Code Size By Language +--------------------- + .. image:: ./languages.svg Usage From 43327bbe23d0f0ea99e70f5679c2a1f126554252 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:16:14 -0500 Subject: [PATCH 301/326] Change answer type to i128 in anticipation of prob 27, constrain other types --- rust/src/main.rs | 4 ++-- rust/src/p0001.rs | 4 ++-- rust/src/p0002.rs | 4 ++-- rust/src/p0003.rs | 4 ++-- rust/src/p0004.rs | 4 ++-- rust/src/p0005.rs | 6 +++--- rust/src/p0006.rs | 4 ++-- rust/src/p0007.rs | 4 ++-- rust/src/p0008.rs | 8 ++++---- rust/src/p0009.rs | 4 ++-- rust/src/p0010.rs | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index dc92f6dc..c32db45b 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -14,8 +14,8 @@ mod p~N; }); mod primes; -type ProblemType = fn() -> u64; -type ProblemRef<'a> = (&'a str, ProblemType, u64); +type ProblemType = fn() -> i128; +type ProblemRef<'a> = (&'a str, ProblemType, i128); const ANSWERS: [ProblemRef; 10] = [ ("p0001", p0001::p0001, 233168), ("p0002", p0002::p0002, 4613732), diff --git a/rust/src/p0001.rs b/rust/src/p0001.rs index 4176b8f2..ae8e0d26 100644 --- a/rust/src/p0001.rs +++ b/rust/src/p0001.rs @@ -11,8 +11,8 @@ get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. */ -pub fn p0001() -> u64 { - let mut answer: u64 = 0; +pub fn p0001() -> i128 { + let mut answer: u32 = 0; for i in (0..1000).step_by(3) { answer += i; } diff --git a/rust/src/p0002.rs b/rust/src/p0002.rs index 68246133..f9072d54 100644 --- a/rust/src/p0002.rs +++ b/rust/src/p0002.rs @@ -14,8 +14,8 @@ terms. By starting with 1 and 2, the first 10 terms will be: By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. */ -pub fn p0002() -> u64 { - let mut answer = 0; +pub fn p0002() -> i128 { + let mut answer: u64 = 0; let mut i = 2; let mut j = 8; while i < 4000000 { diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index f459dcd5..f06b076b 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -11,6 +11,6 @@ What is the largest prime factor of the number 600851475143 ? */ use crate::primes::prime_factors; -pub fn p0003() -> u64 { - return prime_factors(600851475143).max().expect("This number has prime factors"); +pub fn p0003() -> i128 { + return prime_factors::(600851475143).max().expect("This number has prime factors"); } diff --git a/rust/src/p0004.rs b/rust/src/p0004.rs index 98e18d62..de1695d6 100644 --- a/rust/src/p0004.rs +++ b/rust/src/p0004.rs @@ -19,8 +19,8 @@ fn is_palindrome(x: u64) -> bool { return s == s.chars().rev().collect::(); } -pub fn p0004() -> u64 { - let mut answer: u64 = 0; +pub fn p0004() -> i128 { + let mut answer: u32 = 0; for v in (100..1000).combinations(2) { let p = v.into_iter().product(); if is_palindrome(p) && p > answer { diff --git a/rust/src/p0005.rs b/rust/src/p0005.rs index 1d96f2c1..8dd0c112 100644 --- a/rust/src/p0005.rs +++ b/rust/src/p0005.rs @@ -15,9 +15,9 @@ numbers from 1 to 20? */ use itertools::Itertools; -pub fn p0005() -> u64 { - let mut answer = u64::MAX; - let group = 1..=20u64; +pub fn p0005() -> i128 { + let mut answer = u32::MAX; + let group = 1..=20u32; for x in group.clone() { for multiples in group.clone().combinations(x as usize) { let num = multiples.into_iter().product(); diff --git a/rust/src/p0006.rs b/rust/src/p0006.rs index adc4d04a..fd787678 100644 --- a/rust/src/p0006.rs +++ b/rust/src/p0006.rs @@ -19,10 +19,10 @@ natural numbers and the square of the sum. */ -pub fn p0006() -> u64 { +pub fn p0006() -> i128 { let group = 1..101; let sum_of_squares = group.clone().fold(0, |x, y| x + y * y); - let sum: u64 = group.sum(); + let sum: u32 = group.sum(); let square_of_sum = sum * sum; return square_of_sum - sum_of_squares; } diff --git a/rust/src/p0007.rs b/rust/src/p0007.rs index 5010ca30..217e3cab 100644 --- a/rust/src/p0007.rs +++ b/rust/src/p0007.rs @@ -11,6 +11,6 @@ What is the 10 001st prime number? */ use crate::primes::primes; -pub fn p0007() -> u64 { - return primes().take(10001).last().unwrap(); +pub fn p0007() -> i128 { + return primes::().take(10001).last().unwrap(); } diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index 2c582811..93529037 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -35,7 +35,7 @@ greatest product. What is the value of this product? */ -pub fn p0008() -> u64 { +pub fn p0008() -> i128 { let string = concat!( "73167176531330624919225119674426574742355349194934", "96983520312774506326239578318016984801869478851843", @@ -58,12 +58,12 @@ pub fn p0008() -> u64 { "05886116467109405077541002256983155200055935729725", "71636269561882670428252483600823257530420752963450" ); - let mut answer: u64 = 0; + let mut answer: u32 = 0; for i in 0..(string.len() - 13) { let slice = &string[i..(i + 13)]; - let mut prod: u64 = 1; + let mut prod: u32 = 1; for c in slice.bytes() { - prod *= (c as u32 - '0' as u32) as u64; + prod *= c as u32 - '0' as u32; } if prod > answer { answer = prod; diff --git a/rust/src/p0009.rs b/rust/src/p0009.rs index a315574a..0fd58b8f 100644 --- a/rust/src/p0009.rs +++ b/rust/src/p0009.rs @@ -13,9 +13,9 @@ For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ -const MAX: u64 = 500; +const MAX: u32 = 500; -pub fn p0009() -> u64 { +pub fn p0009() -> i128 { for c in 3..MAX { let c_square = c * c; for b in 2..c { diff --git a/rust/src/p0010.rs b/rust/src/p0010.rs index 9caaf5b4..7db808b5 100644 --- a/rust/src/p0010.rs +++ b/rust/src/p0010.rs @@ -12,6 +12,6 @@ Find the sum of all the primes below two million. */ use crate::primes::primes; -pub fn p0010() -> u64 { +pub fn p0010() -> i128 { return primes::().take_while(|&p| p < 2000000).sum(); } From 0bf99db9f4da437a79f5328b0d8a6406ef6b59a1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:22:19 -0500 Subject: [PATCH 302/326] Fix various type errors --- rust/src/p0001.rs | 2 +- rust/src/p0002.rs | 2 +- rust/src/p0003.rs | 5 ++++- rust/src/p0004.rs | 6 +++--- rust/src/p0005.rs | 2 +- rust/src/p0006.rs | 2 +- rust/src/p0007.rs | 6 +++++- rust/src/p0008.rs | 2 +- rust/src/p0009.rs | 2 +- rust/src/p0010.rs | 5 ++++- 10 files changed, 22 insertions(+), 12 deletions(-) diff --git a/rust/src/p0001.rs b/rust/src/p0001.rs index ae8e0d26..9b752667 100644 --- a/rust/src/p0001.rs +++ b/rust/src/p0001.rs @@ -22,5 +22,5 @@ pub fn p0001() -> i128 { for i in (0..1000).step_by(15) { answer -= i; } - return answer; + return answer.into(); } diff --git a/rust/src/p0002.rs b/rust/src/p0002.rs index f9072d54..408e5d96 100644 --- a/rust/src/p0002.rs +++ b/rust/src/p0002.rs @@ -24,5 +24,5 @@ pub fn p0002() -> i128 { i = j; j = tmp; } - return answer; + return answer.into(); } diff --git a/rust/src/p0003.rs b/rust/src/p0003.rs index f06b076b..af957126 100644 --- a/rust/src/p0003.rs +++ b/rust/src/p0003.rs @@ -12,5 +12,8 @@ What is the largest prime factor of the number 600851475143 ? use crate::primes::prime_factors; pub fn p0003() -> i128 { - return prime_factors::(600851475143).max().expect("This number has prime factors"); + return prime_factors::(600851475143) + .max() + .expect("This number has prime factors") + .into(); } diff --git a/rust/src/p0004.rs b/rust/src/p0004.rs index de1695d6..aac0a033 100644 --- a/rust/src/p0004.rs +++ b/rust/src/p0004.rs @@ -14,7 +14,7 @@ Find the largest palindrome made from the product of two 3-digit numbers. */ use itertools::Itertools; -fn is_palindrome(x: u64) -> bool { +fn is_palindrome(x: u32) -> bool { let s = x.to_string(); return s == s.chars().rev().collect::(); } @@ -22,11 +22,11 @@ fn is_palindrome(x: u64) -> bool { pub fn p0004() -> i128 { let mut answer: u32 = 0; for v in (100..1000).combinations(2) { - let p = v.into_iter().product(); + let p: u32 = v.into_iter().product(); if is_palindrome(p) && p > answer { answer = p; } } - return answer; + return answer.into(); } diff --git a/rust/src/p0005.rs b/rust/src/p0005.rs index 8dd0c112..c6d005e9 100644 --- a/rust/src/p0005.rs +++ b/rust/src/p0005.rs @@ -26,5 +26,5 @@ pub fn p0005() -> i128 { } } } - return answer; + return answer.into(); } diff --git a/rust/src/p0006.rs b/rust/src/p0006.rs index fd787678..79d0e1b9 100644 --- a/rust/src/p0006.rs +++ b/rust/src/p0006.rs @@ -24,5 +24,5 @@ pub fn p0006() -> i128 { let sum_of_squares = group.clone().fold(0, |x, y| x + y * y); let sum: u32 = group.sum(); let square_of_sum = sum * sum; - return square_of_sum - sum_of_squares; + return (square_of_sum - sum_of_squares).into(); } diff --git a/rust/src/p0007.rs b/rust/src/p0007.rs index 217e3cab..74ffe6ce 100644 --- a/rust/src/p0007.rs +++ b/rust/src/p0007.rs @@ -12,5 +12,9 @@ What is the 10 001st prime number? use crate::primes::primes; pub fn p0007() -> i128 { - return primes::().take(10001).last().unwrap(); + return primes::() + .take(10001) + .last() + .unwrap() + .into(); } diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index 93529037..bcb10dc1 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -69,5 +69,5 @@ pub fn p0008() -> i128 { answer = prod; } } - return answer; + return answer.into(); } diff --git a/rust/src/p0009.rs b/rust/src/p0009.rs index 0fd58b8f..61ebfed8 100644 --- a/rust/src/p0009.rs +++ b/rust/src/p0009.rs @@ -23,7 +23,7 @@ pub fn p0009() -> i128 { for a in 1..b { let a_square = a * a; if a_square + b_square == c_square && a + b + c == 1000 { - return a * b * c; + return (a * b * c).into(); } } } diff --git a/rust/src/p0010.rs b/rust/src/p0010.rs index 7db808b5..d5df19bd 100644 --- a/rust/src/p0010.rs +++ b/rust/src/p0010.rs @@ -13,5 +13,8 @@ Find the sum of all the primes below two million. use crate::primes::primes; pub fn p0010() -> i128 { - return primes::().take_while(|&p| p < 2000000).sum(); + return primes::() + .take_while(|&p| p < 2000000) + .sum() + .into(); } From 26d06f33047e6b090dda54331a2cc53bc831fd04 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:24:03 -0500 Subject: [PATCH 303/326] Fix type inference error --- rust/src/p0010.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0010.rs b/rust/src/p0010.rs index d5df19bd..f0ccb456 100644 --- a/rust/src/p0010.rs +++ b/rust/src/p0010.rs @@ -15,6 +15,6 @@ use crate::primes::primes; pub fn p0010() -> i128 { return primes::() .take_while(|&p| p < 2000000) - .sum() + .sum::() .into(); } From 7980c6afb898f2a661c1893816339f56bfe6c6b8 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:31:30 -0500 Subject: [PATCH 304/326] Fix overflows --- rust/src/p0005.rs | 4 ++-- rust/src/p0007.rs | 2 +- rust/src/p0008.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/src/p0005.rs b/rust/src/p0005.rs index c6d005e9..83ece417 100644 --- a/rust/src/p0005.rs +++ b/rust/src/p0005.rs @@ -16,8 +16,8 @@ numbers from 1 to 20? use itertools::Itertools; pub fn p0005() -> i128 { - let mut answer = u32::MAX; - let group = 1..=20u32; + let mut answer = u64::MAX; + let group = 1..=20u64; for x in group.clone() { for multiples in group.clone().combinations(x as usize) { let num = multiples.into_iter().product(); diff --git a/rust/src/p0007.rs b/rust/src/p0007.rs index 74ffe6ce..5e61439f 100644 --- a/rust/src/p0007.rs +++ b/rust/src/p0007.rs @@ -12,7 +12,7 @@ What is the 10 001st prime number? use crate::primes::primes; pub fn p0007() -> i128 { - return primes::() + return primes::() .take(10001) .last() .unwrap() diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index bcb10dc1..c8759441 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -58,10 +58,10 @@ pub fn p0008() -> i128 { "05886116467109405077541002256983155200055935729725", "71636269561882670428252483600823257530420752963450" ); - let mut answer: u32 = 0; + let mut answer: u64 = 0; for i in 0..(string.len() - 13) { let slice = &string[i..(i + 13)]; - let mut prod: u32 = 1; + let mut prod: u64 = 1; for c in slice.bytes() { prod *= c as u32 - '0' as u32; } From 666a544da08a64077f78e9c6320c609f65d134ea Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 01:33:13 -0500 Subject: [PATCH 305/326] Fix type error --- rust/src/p0008.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index c8759441..ef9902b3 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -63,7 +63,7 @@ pub fn p0008() -> i128 { let slice = &string[i..(i + 13)]; let mut prod: u64 = 1; for c in slice.bytes() { - prod *= c as u32 - '0' as u32; + prod *= (c as u32 - '0' as u32) as u64; } if prod > answer { answer = prod; From 6a7c468c1142113a9d4eaa52dd49d593689efe6a Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 22:58:47 -0500 Subject: [PATCH 306/326] solve problems 6, 8, 9 in JavaScript --- README.rst | 2 +- docs/index.rst | 6 ++-- docs/javascript/p0006.rst | 10 ++++++ docs/javascript/p0008.rst | 10 ++++++ docs/javascript/p0009.rst | 10 ++++++ javascript/p0006.js | 32 +++++++++++++++++ javascript/p0008.js | 73 +++++++++++++++++++++++++++++++++++++++ javascript/p0009.js | 34 ++++++++++++++++++ javascript/test.js | 3 ++ 9 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 docs/javascript/p0006.rst create mode 100644 docs/javascript/p0008.rst create mode 100644 docs/javascript/p0009.rst create mode 100644 javascript/p0006.js create mode 100644 javascript/p0008.js create mode 100644 javascript/p0009.js diff --git a/README.rst b/README.rst index cf6a1286..c6cfedc0 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------+---------------+ | C# | .NET 2+ | 2 | |C#i| | +------------+---------------------+--------+---------------+ -| JavaScript | Node 12+ | 2 | |JavaScript| | +| JavaScript | Node 12+ | 5 | |JavaScript| | +------------+---------------------+--------+---------------+ | Python | CPython 3.6+ |br| | 70 | |Python| | | | Pypy 3.6+ |br| | | | diff --git a/docs/index.rst b/docs/index.rst index 31eb86cd..732623c1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -109,13 +109,13 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`5` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`6` | |d| | | | |d| | |d| | +|:prob:`6` | |d| | | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`7` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`8` | |d| | | | |d| | |d| | +|:prob:`8` | |d| | | |d| | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`9` | |d| | | | |d| | |d| | +|:prob:`9` | |d| | | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`10` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ diff --git a/docs/javascript/p0006.rst b/docs/javascript/p0006.rst new file mode 100644 index 00000000..db13c784 --- /dev/null +++ b/docs/javascript/p0006.rst @@ -0,0 +1,10 @@ +JavaScript Implementation of Problem 6 +====================================== + +View source code `here on GitHub! `_ + +.. js:autofunction:: p0006 + +.. literalinclude:: ../../javascript/p0006.js + :language: javascript + :linenos: diff --git a/docs/javascript/p0008.rst b/docs/javascript/p0008.rst new file mode 100644 index 00000000..86cd2c42 --- /dev/null +++ b/docs/javascript/p0008.rst @@ -0,0 +1,10 @@ +JavaScript Implementation of Problem 8 +====================================== + +View source code `here on GitHub! `_ + +.. js:autofunction:: p0008 + +.. literalinclude:: ../../javascript/p0008.js + :language: javascript + :linenos: diff --git a/docs/javascript/p0009.rst b/docs/javascript/p0009.rst new file mode 100644 index 00000000..726f9d16 --- /dev/null +++ b/docs/javascript/p0009.rst @@ -0,0 +1,10 @@ +JavaScript Implementation of Problem 9 +====================================== + +View source code `here on GitHub! `_ + +.. js:autofunction:: p0009 + +.. literalinclude:: ../../javascript/p0009.js + :language: javascript + :linenos: diff --git a/javascript/p0006.js b/javascript/p0006.js new file mode 100644 index 00000000..3942f8e1 --- /dev/null +++ b/javascript/p0006.js @@ -0,0 +1,32 @@ +/** + * Project Euler Problem 6 + * + * This turned out to be really easy + * + * Problem: + * + * The sum of the squares of the first ten natural numbers is, + * 1**2 + 2**2 + ... + 10**2 = 385 + * + * The square of the sum of the first ten natural numbers is, + * (1 + 2 + ... + 10)**2 = 55**2 = 3025 + * + * Hence the difference between the sum of the squares of the first ten natural + * numbers and the square of the sum is 3025 − 385 = 2640. + * + * Find the difference between the sum of the squares of the first one hundred + * natural numbers and the square of the sum. + * + * @return {number} + */ + +exports.p0006 = function() { + let sum = 1; + let sum_of_squares = 1; + for (let i = 2; i < 101; i++) { + sum_of_squares += i * i; + sum += i; + } + let square_of_sum = sum * sum; + return square_of_sum - sum_of_squares; +} diff --git a/javascript/p0008.js b/javascript/p0008.js new file mode 100644 index 00000000..2e8d9415 --- /dev/null +++ b/javascript/p0008.js @@ -0,0 +1,73 @@ +/** + * Project Euler Problem 8 + * + * In Python I did this with an iterator, but that is more cumbersome here, + * so I just did it with a loop that slices and takes advantage of JavaScript's type coersion + * + * Problem: + * + * The four adjacent digits in the 1000-digit number that have the greatest + * product are 9 × 9 × 8 × 9 = 5832. + * + * 73167176531330624919225119674426574742355349194934 + * 96983520312774506326239578318016984801869478851843 + * 85861560789112949495459501737958331952853208805511 + * 12540698747158523863050715693290963295227443043557 + * 66896648950445244523161731856403098711121722383113 + * 62229893423380308135336276614282806444486645238749 + * 30358907296290491560440772390713810515859307960866 + * 70172427121883998797908792274921901699720888093776 + * 65727333001053367881220235421809751254540594752243 + * 52584907711670556013604839586446706324415722155397 + * 53697817977846174064955149290862569321978468622482 + * 83972241375657056057490261407972968652414535100474 + * 82166370484403199890008895243450658541227588666881 + * 16427171479924442928230863465674813919123162824586 + * 17866458359124566529476545682848912883142607690042 + * 24219022671055626321111109370544217506941658960408 + * 07198403850962455444362981230987879927244284909188 + * 84580156166097919133875499200524063689912560717606 + * 05886116467109405077541002256983155200055935729725 + * 71636269561882670428252483600823257530420752963450 + * + * Find the thirteen adjacent digits in the 1000-digit number that have the + * greatest product. What is the value of this product? + * + * @return {number} + */ + +exports.p0008 = function() { + let string = ( + "73167176531330624919225119674426574742355349194934" + + "96983520312774506326239578318016984801869478851843" + + "85861560789112949495459501737958331952853208805511" + + "12540698747158523863050715693290963295227443043557" + + "66896648950445244523161731856403098711121722383113" + + "62229893423380308135336276614282806444486645238749" + + "30358907296290491560440772390713810515859307960866" + + "70172427121883998797908792274921901699720888093776" + + "65727333001053367881220235421809751254540594752243" + + "52584907711670556013604839586446706324415722155397" + + "53697817977846174064955149290862569321978468622482" + + "83972241375657056057490261407972968652414535100474" + + "82166370484403199890008895243450658541227588666881" + + "16427171479924442928230863465674813919123162824586" + + "17866458359124566529476545682848912883142607690042" + + "24219022671055626321111109370544217506941658960408" + + "07198403850962455444362981230987879927244284909188" + + "84580156166097919133875499200524063689912560717606" + + "05886116467109405077541002256983155200055935729725" + + "71636269561882670428252483600823257530420752963450" + ); + let answer = 0; + for (let i = 0; i < string.length - 13; i++) { + let prod = 1; + for (let c = i; c < i + 13; c++) { + prod *= string[c]; + } + if (prod > answer) { + answer = prod; + } + } + return answer; +} diff --git a/javascript/p0009.js b/javascript/p0009.js new file mode 100644 index 00000000..b375fdb9 --- /dev/null +++ b/javascript/p0009.js @@ -0,0 +1,34 @@ +/** + * Project Euler Problem 9 + * + * Brute force on this problem has been very effective, so why stop now + * + * Problem: + * + * A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, + * a**2 + b**2 = c**2 + * + * For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. + * + * There exists exactly one Pythagorean triplet for which a + b + c = 1000. + * Find the product abc. + * + * @return {number} + */ +const MAX = 500; + +exports.p0009 = function() { + for (let c = 3; c < MAX; c++) { + let c_square = c * c; + for (let b = 2; b < c; b++) { + let b_square = b * b; + for (let a = 1; a < b; a++) { + let a_square = a * a; + if (a_square + b_square == c_square && a + b + c === 1000) { + return a * b * c; + } + } + } + } + return 0; +} diff --git a/javascript/test.js b/javascript/test.js index 65a47eca..8f4c2b10 100644 --- a/javascript/test.js +++ b/javascript/test.js @@ -4,6 +4,9 @@ const assert = require('assert'); const answers = { 1: 233168, 2: 4613732, + 6: 25164150, + 8: 23514624000, + 9: 31875000, }; const knownSlow = []; let benchmarkReport = ''; From a5710fce21c0a2663ae087a29a234c88604d755d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 22:59:22 -0500 Subject: [PATCH 307/326] global `make test` will no longer fail on termux --- csharp/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/csharp/Makefile b/csharp/Makefile index e4a9292e..47663da4 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -1,3 +1,4 @@ +NOT_TERMUX?=$(shell command -v termux-setup-storage > /dev/null 2>&1 ; echo $$?) BLUE=\033[0;34m NC=\033[0m # No Color COV?=false @@ -18,13 +19,19 @@ clean: dotnet clean || rm ./*/{bin,obj,TestResults} || echo test: dependencies +ifneq ($(NOT_TERMUX),0) dotnet test --nologo $(cov_args) +endif test_%: dependencies $(MAKE) test $(MFLAGS) dependencies: +ifneq ($(NOT_TERMUX),0) dotnet restore +endif lint: +ifneq ($(NOT_TERMUX),0) dotnet format --verify-no-changes +endif From 86290c45a66e8d486653aa00840590694195f7fb Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 23:16:55 -0500 Subject: [PATCH 308/326] Fix timeout, doc gen errors --- javascript/p0009.js | 3 +-- javascript/test.js | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/javascript/p0009.js b/javascript/p0009.js index b375fdb9..bdedfecd 100644 --- a/javascript/p0009.js +++ b/javascript/p0009.js @@ -15,9 +15,8 @@ * * @return {number} */ -const MAX = 500; - exports.p0009 = function() { + const MAX = 500; for (let c = 3; c < MAX; c++) { let c_square = c * c; for (let b = 2; b < c; b++) { diff --git a/javascript/test.js b/javascript/test.js index 8f4c2b10..76de5c0f 100644 --- a/javascript/test.js +++ b/javascript/test.js @@ -21,6 +21,9 @@ for (question in answers) { if (knownSlow.includes(question)) { this.timeout(-1); } + else { + this.timeout(60 * 1000); + } assert.equal(answer, module[`p${formattedQuestion}`]()); }); it('should return take less than 1 minute', function(done) { From 7c31f1f5c824e17de8161b67f8e9bd768043a7fe Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 23:59:45 -0500 Subject: [PATCH 309/326] Solve problems 6, 8, 9 in C# --- README.rst | 2 +- csharp/Euler.Test/test.cs | 3 ++ csharp/Euler/p0006.cs | 39 +++++++++++++++++++ csharp/Euler/p0008.cs | 81 +++++++++++++++++++++++++++++++++++++++ csharp/Euler/p0009.cs | 40 +++++++++++++++++++ csharp/Makefile | 4 +- docs/csharp/p0006.rst | 16 ++++++++ docs/csharp/p0008.rst | 16 ++++++++ docs/csharp/p0009.rst | 16 ++++++++ docs/index.rst | 6 +-- 10 files changed, 217 insertions(+), 6 deletions(-) create mode 100644 csharp/Euler/p0006.cs create mode 100644 csharp/Euler/p0008.cs create mode 100644 csharp/Euler/p0009.cs create mode 100644 docs/csharp/p0006.rst create mode 100644 docs/csharp/p0008.rst create mode 100644 docs/csharp/p0009.rst diff --git a/README.rst b/README.rst index c6cfedc0..8843b002 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ LivInTheLookingGlass’s Project Euler solutions | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+---------------+ -| C# | .NET 2+ | 2 | |C#i| | +| C# | .NET 2+ | 5 | |C#i| | +------------+---------------------+--------+---------------+ | JavaScript | Node 12+ | 5 | |JavaScript| | +------------+---------------------+--------+---------------+ diff --git a/csharp/Euler.Test/test.cs b/csharp/Euler.Test/test.cs index 930c08c6..23e81e9a 100644 --- a/csharp/Euler.Test/test.cs +++ b/csharp/Euler.Test/test.cs @@ -10,6 +10,9 @@ public static IEnumerable Data() yield return new object[] { typeof(p0000), 0 }; yield return new object[] { typeof(p0001), 233168 }; yield return new object[] { typeof(p0002), 4613732 }; + yield return new object[] { typeof(p0006), 25164150 }; + yield return new object[] { typeof(p0008), 23514624000 }; + yield return new object[] { typeof(p0009), 31875000 }; } [Theory] diff --git a/csharp/Euler/p0006.cs b/csharp/Euler/p0006.cs new file mode 100644 index 00000000..561f8750 --- /dev/null +++ b/csharp/Euler/p0006.cs @@ -0,0 +1,39 @@ +/* +Project Euler Problem 6 + +This turned out to be really easy + +Problem: + +The sum of the squares of the first ten natural numbers is, +1**2 + 2**2 + ... + 10**2 = 385 + +The square of the sum of the first ten natural numbers is, +(1 + 2 + ... + 10)**2 = 55**2 = 3025 + +Hence the difference between the sum of the squares of the first ten natural +numbers and the square of the sum is 3025 − 385 = 2640. + +Find the difference between the sum of the squares of the first one hundred +natural numbers and the square of the sum. +*/ +using System; + +namespace Euler +{ + public class p0006 : IEuler + { + public Task Answer() + { + Int64 sum_of_squares = 0, + sum = 0; + for (int i = 1; i < 101; i++) + { + sum += i; + sum_of_squares += i * i; + } + Int64 square_of_sum = sum * sum; + return Task.FromResult(square_of_sum - sum_of_squares); + } + } +} diff --git a/csharp/Euler/p0008.cs b/csharp/Euler/p0008.cs new file mode 100644 index 00000000..3ad96249 --- /dev/null +++ b/csharp/Euler/p0008.cs @@ -0,0 +1,81 @@ +/* +Project Euler Problem 8 + +In Python I did this with an iterator, but that is more cumbersome here, +so I just did it with a loop that slices. + +Problem: + +The four adjacent digits in the 1000-digit number that have the greatest +product are 9 × 9 × 8 × 9 = 5832. + +73167176531330624919225119674426574742355349194934 +96983520312774506326239578318016984801869478851843 +85861560789112949495459501737958331952853208805511 +12540698747158523863050715693290963295227443043557 +66896648950445244523161731856403098711121722383113 +62229893423380308135336276614282806444486645238749 +30358907296290491560440772390713810515859307960866 +70172427121883998797908792274921901699720888093776 +65727333001053367881220235421809751254540594752243 +52584907711670556013604839586446706324415722155397 +53697817977846174064955149290862569321978468622482 +83972241375657056057490261407972968652414535100474 +82166370484403199890008895243450658541227588666881 +16427171479924442928230863465674813919123162824586 +17866458359124566529476545682848912883142607690042 +24219022671055626321111109370544217506941658960408 +07198403850962455444362981230987879927244284909188 +84580156166097919133875499200524063689912560717606 +05886116467109405077541002256983155200055935729725 +71636269561882670428252483600823257530420752963450 + +Find the thirteen adjacent digits in the 1000-digit number that have the +greatest product. What is the value of this product? +*/ +using System; + +namespace Euler +{ + public class p0008 : IEuler + { + private const int MAX = 500; + public Task Answer() + { + String str = String.Concat( + "73167176531330624919225119674426574742355349194934", + "96983520312774506326239578318016984801869478851843", + "85861560789112949495459501737958331952853208805511", + "12540698747158523863050715693290963295227443043557", + "66896648950445244523161731856403098711121722383113", + "62229893423380308135336276614282806444486645238749", + "30358907296290491560440772390713810515859307960866", + "70172427121883998797908792274921901699720888093776", + "65727333001053367881220235421809751254540594752243", + "52584907711670556013604839586446706324415722155397", + "53697817977846174064955149290862569321978468622482", + "83972241375657056057490261407972968652414535100474", + "82166370484403199890008895243450658541227588666881", + "16427171479924442928230863465674813919123162824586", + "17866458359124566529476545682848912883142607690042", + "24219022671055626321111109370544217506941658960408", + "07198403850962455444362981230987879927244284909188", + "84580156166097919133875499200524063689912560717606", + "05886116467109405077541002256983155200055935729725", + "71636269561882670428252483600823257530420752963450" + ); + Int64 answer = 0; + for (int i = 0; i < str.Length - 13; i++) { + String slice = str.Substring(i, 13); + Int64 prod = 1; + foreach (char c in slice) { + prod *= c - '0'; + } + if (prod > answer) { + answer = prod; + } + } + return Task.FromResult(answer); + } + } +} diff --git a/csharp/Euler/p0009.cs b/csharp/Euler/p0009.cs new file mode 100644 index 00000000..333f5a5d --- /dev/null +++ b/csharp/Euler/p0009.cs @@ -0,0 +1,40 @@ +/* +Project Euler Problem 9 + + + +Problem: + +A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, +a**2 + b**2 = c**2 + +For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. + +There exists exactly one Pythagorean triplet for which a + b + c = 1000. +Find the product abc. +*/ +using System; + +namespace Euler +{ + public class p0009 : IEuler + { + private const int MAX = 500; + public Task Answer() + { + for (int c = 3; c < MAX; c++) { + int c_square = c * c; + for (int b = 2; b < c; b++) { + int b_square = b * b; + for (int a = 1; a < b; a++) { + int a_square = a * a; + if (a_square + b_square == c_square && a + b + c == 1000) { + return Task.FromResult(a * b * c); + } + } + } + } + return Task.FromResult(0); + } + } +} diff --git a/csharp/Makefile b/csharp/Makefile index 47663da4..ded81397 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -18,12 +18,12 @@ help: clean: dotnet clean || rm ./*/{bin,obj,TestResults} || echo -test: dependencies +test: ifneq ($(NOT_TERMUX),0) dotnet test --nologo $(cov_args) endif -test_%: dependencies +test_%: $(MAKE) test $(MFLAGS) dependencies: diff --git a/docs/csharp/p0006.rst b/docs/csharp/p0006.rst new file mode 100644 index 00000000..45d53110 --- /dev/null +++ b/docs/csharp/p0006.rst @@ -0,0 +1,16 @@ +C# Implementation of Problem 6 +============================== + +View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: p0006 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task Answer() + +.. literalinclude:: ../../csharp/Euler/p0006.cs + :language: csharp + :linenos: diff --git a/docs/csharp/p0008.rst b/docs/csharp/p0008.rst new file mode 100644 index 00000000..75897f0a --- /dev/null +++ b/docs/csharp/p0008.rst @@ -0,0 +1,16 @@ +C# Implementation of Problem 8 +============================== + +View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: p0008 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task Answer() + +.. literalinclude:: ../../csharp/Euler/p0008.cs + :language: csharp + :linenos: diff --git a/docs/csharp/p0009.rst b/docs/csharp/p0009.rst new file mode 100644 index 00000000..0e1b3311 --- /dev/null +++ b/docs/csharp/p0009.rst @@ -0,0 +1,16 @@ +C# Implementation of Problem 9 +============================== + +View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: p0009 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task Answer() + +.. literalinclude:: ../../csharp/Euler/p0009.cs + :language: csharp + :linenos: diff --git a/docs/index.rst b/docs/index.rst index 732623c1..3aaab0fb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -109,13 +109,13 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+ |:prob:`5` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`6` | |d| | | |d| | |d| | |d| | +|:prob:`6` | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`7` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`8` | |d| | | |d| | |d| | |d| | +|:prob:`8` | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ -|:prob:`9` | |d| | | |d| | |d| | |d| | +|:prob:`9` | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+ |:prob:`10` | |d| | | | |d| | |d| | +-----------+------+------+------+------+------+ From 4f72a393afb61881d30daab5337ccd11b626b9ff Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 11:49:34 -0500 Subject: [PATCH 310/326] `dotnet format` --- csharp/Euler/p0008.cs | 9 ++++++--- csharp/Euler/p0009.cs | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/csharp/Euler/p0008.cs b/csharp/Euler/p0008.cs index 3ad96249..c5678630 100644 --- a/csharp/Euler/p0008.cs +++ b/csharp/Euler/p0008.cs @@ -65,13 +65,16 @@ public Task Answer() "71636269561882670428252483600823257530420752963450" ); Int64 answer = 0; - for (int i = 0; i < str.Length - 13; i++) { + for (int i = 0; i < str.Length - 13; i++) + { String slice = str.Substring(i, 13); Int64 prod = 1; - foreach (char c in slice) { + foreach (char c in slice) + { prod *= c - '0'; } - if (prod > answer) { + if (prod > answer) + { answer = prod; } } diff --git a/csharp/Euler/p0009.cs b/csharp/Euler/p0009.cs index 333f5a5d..562d7ce7 100644 --- a/csharp/Euler/p0009.cs +++ b/csharp/Euler/p0009.cs @@ -22,13 +22,17 @@ public class p0009 : IEuler private const int MAX = 500; public Task Answer() { - for (int c = 3; c < MAX; c++) { + for (int c = 3; c < MAX; c++) + { int c_square = c * c; - for (int b = 2; b < c; b++) { + for (int b = 2; b < c; b++) + { int b_square = b * b; - for (int a = 1; a < b; a++) { + for (int a = 1; a < b; a++) + { int a_square = a * a; - if (a_square + b_square == c_square && a + b + c == 1000) { + if (a_square + b_square == c_square && a + b + c == 1000) + { return Task.FromResult(a * b * c); } } From c44c28c9d30bc753b2cb4d6dda9151838283f3dc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 13:34:12 -0500 Subject: [PATCH 311/326] Add standards variation testing --- c/test_euler.py | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/c/test_euler.py b/c/test_euler.py index bd98e1df..397c94a2 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -50,6 +50,7 @@ IN_OSX = system() == 'Darwin' IN_TERMUX = bool(which('termux-setup-storage')) IN_LINUX = (not IN_TERMUX) and (system() == 'Linux') +STANDARDS = ('c99', 'c11', 'c17') if IN_TERMUX: BUILD_FOLDER = Path.home().joinpath('build') # Termux can't make executable files outside of $HOME @@ -106,15 +107,18 @@ compilers.extend(environ['COMPILER_OVERRIDE'].upper().split(',')) else: if not (IN_TERMUX and GCC_BINARY == 'gcc') and which(GCC_BINARY): # Termux maps gcc->clang - compilers.append('GCC') + compilers.extend(f'GCC+{std}' for std in STANDARDS) if which('clang'): if b'AOCC' in check_output(['clang', '--version']): - compilers.append('AOCC') + compilers.extend(f'AOCC+{std}' for std in STANDARDS) else: - compilers.append('CLANG') + compilers.extend(f'CLANG+{std}' for std in STANDARDS) if AOCC_BINARY != 'clang' and which(AOCC_BINARY): - compilers.append('AOCC') - for x in ('cl', 'icc', 'pcc', 'tcc'): + compilers.extend(f'AOCC+{std}' for std in STANDARDS) + for x in ('icc', 'icc'): + if which(x): + compilers.extend(f'{x.upper()}+{std}' for std in STANDARDS) + for x in ('pcc', 'tcc'): if which(x): compilers.append(x.upper()) if not compilers: @@ -149,20 +153,24 @@ EXE_TEMPLATE = "{}{}p{{:0>4}}.{{}}.{}".format(BUILD_FOLDER, sep, EXE_EXT) # include sep in the recipe so that Windows won't complain -GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std=c11 -march=native -flto -fwhole-program -o {{}}" +GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std={} -march=native -flto -fwhole-program -o {{}}" if environ.get('COV') == 'true': GCC_TEMPLATE += ' -ftest-coverage -fprofile-arcs' -CLANG_TEMPLATE = "{} {{}} -O2 {} {} -Wall -Werror -std=c11 {} -o {{}}" +CLANG_TEMPLATE = "{} {{}} -O2 {} {} -Wall -Werror -std={} {} -o {{}}" templates = { - 'GCC': GCC_TEMPLATE.format(GCC_BINARY), - 'CLANG': CLANG_TEMPLATE.format('clang', CLANG_LINK_MATH, CLANG_ARCH, '-DAMD_COMPILER=0'), - 'CL': "cl -Fe:{{1}} -Fo{}\\ -O2 -GL -GF -GW -Brepro -TC {{0}}".format(BUILD_FOLDER.joinpath('objs')), 'TCC': "tcc -lm -Wall -Werror -o {1} {0}", - 'ICC': GCC_TEMPLATE.format('icc'), 'PCC': "pcc -O2 -o {1} {0}", - 'AOCC': CLANG_TEMPLATE.format(AOCC_BINARY, CLANG_LINK_MATH, CLANG_ARCH, '-DAMD_COMPILER=1'), } +for std in STANDARDS: + templates.update({ + f'GCC+{std}': GCC_TEMPLATE.format(GCC_BINARY, std), + f'CLANG+{std}': CLANG_TEMPLATE.format('clang', CLANG_LINK_MATH, CLANG_ARCH, std, '-DAMD_COMPILER=0'), + f'ICC+{std}': GCC_TEMPLATE.format('icc', std), + f'AOCC+{std}': CLANG_TEMPLATE.format(AOCC_BINARY, CLANG_LINK_MATH, CLANG_ARCH, std, '-DAMD_COMPILER=1'), + }) + if std in ('c11', 'c17'): + templates[f'CL+{std}'] = "cl -Fe:{{1}} -Fo{}\\ /std:{} -O2 -GL -GF -GW -Brepro -TC {{0}}".format(BUILD_FOLDER.joinpath('objs'), std) @register @@ -199,13 +207,13 @@ def test_compiler_macros(compiler): buff = check_output([exename]) flags = [bool(int(x)) for x in buff.split()] expect_32 = (compiler == 'GCC' and GCC_NO_64) or (compiler == 'CL' and CL_NO_64) - assert flags[0] == (compiler == "CL") - assert flags[1] == (compiler == "CLANG") - assert flags[2] == (compiler == "GCC") - assert flags[3] == (compiler == "ICC") - assert flags[4] == (compiler == "AOCC") - assert flags[5] == (compiler == "PCC") - assert flags[6] == (compiler == "TCC") + assert flags[0] == compiler.startswith("CL+") + assert flags[1] == compiler.startswith("CLANG") + assert flags[2] == compiler.startswith("GCC") + assert flags[3] == compiler.startswith("ICC") + assert flags[4] == compiler.startswith("AOCC") + assert flags[5] == compiler.startswith("PCC") + assert flags[6] == compiler.startswith("TCC") assert flags[7] == (EXE_EXT == "x86" or expect_32) assert flags[8] == (EXE_EXT == "x86_64" and not expect_32) assert flags[9] == (EXE_EXT not in ("x86", "x86_64", "exe")) @@ -226,7 +234,7 @@ def test_deterministic_build(c_file, compiler): except AssertionError: if IN_WINDOWS and compiler != 'CL': # mingw gcc doesn't seem to make reproducible builds xfail() - elif compiler == 'PCC' and c_file in PCC_no_reproducible: + elif compiler == 'PCC': xfail() # PCC doesn't allow reproducible builds with static keyword elif compiler == 'GCC' and environ.get('COV') == 'true': xfail() # GCC doesn't do reproducible builds w/ code coverage From 611aca8808f2c28306bb0768817f88d97672919c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:00:16 -0500 Subject: [PATCH 312/326] Add a starting C++ solution --- .github/workflows/cplusplus.yml | 95 +++++++ Makefile | 10 +- README.rst | 7 +- c/p0000_template.c | 2 +- cplusplus/Makefile | 42 ++++ cplusplus/include/macros.h | 85 +++++++ cplusplus/p0000_template.cpp | 25 ++ cplusplus/p0001.cpp | 40 +++ cplusplus/requirements.txt | 4 + cplusplus/test_euler.py | 256 +++++++++++++++++++ cplusplus/tests/test_compiler_macros.cpp | 17 ++ docs/cplusplus.rst | 33 +++ docs/cplusplus/p0001.rst | 8 + docs/index.rst | 306 ++++++++++++----------- 14 files changed, 774 insertions(+), 156 deletions(-) create mode 100644 .github/workflows/cplusplus.yml create mode 100644 cplusplus/Makefile create mode 100644 cplusplus/include/macros.h create mode 100644 cplusplus/p0000_template.cpp create mode 100644 cplusplus/p0001.cpp create mode 100644 cplusplus/requirements.txt create mode 100644 cplusplus/test_euler.py create mode 100644 cplusplus/tests/test_compiler_macros.cpp create mode 100644 docs/cplusplus.rst create mode 100644 docs/cplusplus/p0001.rst diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml new file mode 100644 index 00000000..24a5c346 --- /dev/null +++ b/.github/workflows/cplusplus.yml @@ -0,0 +1,95 @@ +name: C++ + +on: + push: + paths-ignore: + - 'docs/**' + - 'README.rst' + schedule: + - cron: "0 0 1 * *" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + c-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup clang-tidy + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: clang-tidy + version: 1.0 + + - name: Run tests + run: make cpp_lint + + cpp: + strategy: + fail-fast: false + matrix: +# compiler: ["llvm", "gcc"] +# # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, + os: [ubuntu-latest, windows-latest, macos-latest, macos-13, 'ubuntu-20.04'] +# include: +# - os: windows-latest +# compiler: msvc +# - os: windows-latest +# compiler: mingw + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Use Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache-dependency-path: '*/requirements.txt' + + - name: Setup tcc, pcc + uses: awalsh128/cache-apt-pkgs-action@latest + if: ${{ matrix.os == 'ubuntu-latest' }} + with: + packages: tcc pcc + version: 1.0 + + - name: Setup MSVC + uses: aminya/setup-cpp@v1 + if: ${{ contains(matrix.os, 'windows') }} + with: + compiler: msvc + vcvarsall: true + +# - name: Set up MinGW +# if: ${{ contains(matrix.os, 'windows') }} +# uses: egor-tensin/setup-mingw@v2 +# with: +# platform: x64 + + - name: Run tests (linux) + if: ${{ contains(matrix.os, 'ubuntu') }} + run: make c_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} COV=true + + - name: Run tests (windows) + if: ${{ contains(matrix.os, 'windows') }} + run: make c_test_auto + + - name: Run tests (macos) + if: ${{ contains(matrix.os, 'macos') }} + run: make c_test_auto + env: + NO_OPTIONAL_TESTS: true + COMPILER_OVERRIDE: clang + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 94ec389a..d1b1dcc1 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,9 @@ help: @echo "The following jobs are available under the c_ prefix" @$(MAKE) c_help $(MFLAGS) --no-print-directory @echo + @echo "The following jobs are available under the cp_ prefix" + @$(MAKE) cp_help $(MFLAGS) --no-print-directory + @echo @echo "The following jobs are available under the cs_ prefix" @$(MAKE) cs_help $(MFLAGS) --no-print-directory @echo @@ -34,11 +37,14 @@ help: html dirhtml singlehtml epub latex: @$(MAKE) docs_$@ $(MFLAGS) -clean: cs_clean c_clean js_clean py_clean rs_clean docs_clean +clean: cs_clean cp_clean c_clean js_clean py_clean rs_clean docs_clean cs_%: @cd csharp && $(MAKE) $* $(MFLAGS) +cp_%: + @cd csharp && $(MAKE) $* $(MFLAGS) + c_%: @cd c && $(MAKE) $* $(MFLAGS) @@ -55,4 +61,4 @@ rs_%: @cd rust && $(MAKE) $* $(MFLAGS) %: - @$(MAKE) c_$* cs_$* js_$* py_$* rs_$* $(MFLAGS) + @$(MAKE) c_$* cp_$* cs_$* js_$* py_$* rs_$* $(MFLAGS) diff --git a/README.rst b/README.rst index 8843b002..6102dbd5 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,8 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml .. |C#i| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml +.. |Cpi| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml .. |JavaScript| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml .. |Python| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg @@ -28,11 +30,13 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------+---------------+ | Language | Version | Solved | Status | +============+=====================+========+===============+ -| C | C11+ in: ``gcc``, | 17 | |Ci| | +| C | C99+ in: ``gcc``, | 17 | |Ci| | | | |br| ``clang``, | | | | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+---------------+ +| C++ | C++98+ | 1 | |Cpi| | ++------------+---------------------+--------+---------------+ | C# | .NET 2+ | 5 | |C#i| | +------------+---------------------+--------+---------------+ | JavaScript | Node 12+ | 5 | |JavaScript| | @@ -77,6 +81,7 @@ The repo is divided into sections for each language. The top-level Makefile will direct recipes using prefixes - ``make c_*`` will go to the c Makefile +- ``make cp_*`` will go to the csharp Makefile - ``make cs_*`` will go to the csharp Makefile - ``make docs_*`` will go to the docs Makefile - ``make js_*`` will go to the javascript Makefile diff --git a/c/p0000_template.c b/c/p0000_template.c index 6d0f0103..8e08e86a 100644 --- a/c/p0000_template.c +++ b/c/p0000_template.c @@ -18,7 +18,7 @@ unsigned long long p0000() { #ifndef UNITY_END int main(int argc, char const *argv[]) { unsigned long long answer = p0000(); - printf("%llu", answer); + printf("%llu\n", answer); return 0; } #endif diff --git a/cplusplus/Makefile b/cplusplus/Makefile new file mode 100644 index 00000000..2f5b5fe6 --- /dev/null +++ b/cplusplus/Makefile @@ -0,0 +1,42 @@ +PY?=python3 +USER_FLAG?=--user +PIP?=$(PY) -m pip +BLUE=\033[0;34m +NC=\033[0m # No Color + +ifneq ($(https_proxy), ) +PROXY_ARG=--proxy=$(https_proxy) +else +ifneq ($(http_proxy), ) +PROXY_ARG=--proxy=$(http_proxy) +else +PROXY_ARG= +endif +endif + +help: + @echo " $(BLUE)test$(NC) run through all tests in sequence. Utilizes the Python test runner infrastructure" + @echo " $(BLUE)test_*$(NC) run through all tests in parallel with the given number of threads. Use auto to allow the test runner to determine it. Utilizes the Python test runner infrastructure" + @echo " $(BLUE)dependencies$(NC) initialize submodules and install any Python dependencies" + @echo " $(BLUE)lint$(NC) run clang-tidy across each of the .cpp and .h files" + @echo " $(BLUE)clean$(NC) clean up any stray files" + +test_%: dependencies + cd ../python; $(MAKE) dependencies $(MFLAGS) + $(PY) -m pytest -vl -n$* test_euler.py --cov + +test: dependencies + $(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py --cov + +dependencies: + $(PIP) install -r requirements.txt -r ../python/requirements.txt $(USER_FLAG) $(PROXY_ARG) + +lint: + if test -z "$(clang-tidy p0000_template.cpp -warnings-as-errors=* 2>&1 | grep "Unknown command line argument")"; then \ + clang-tidy *.cpp -warnings-as-errors=-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling; \ + else \ + clang-tidy *.cpp; \ + fi + +clean: + rm -r build ./{*,*/*}{.pyc,__pycache__,.mypy_cache} || echo diff --git a/cplusplus/include/macros.h b/cplusplus/include/macros.h new file mode 100644 index 00000000..fa195bad --- /dev/null +++ b/cplusplus/include/macros.h @@ -0,0 +1,85 @@ +#ifndef MACROS_H +#define MACROS_H + +// compiler info section + +#if (defined(_MSC_VER) && !defined(__clang__)) + #define CL_COMPILER 1 +#else + #define CL_COMPILER 0 +#endif +#if (defined(__clang__) && (!defined(AMD_COMPILER) || !AMD_COMPILER)) + #define CLANG_COMPILER 1 +#else + #define CLANG_COMPILER 0 +#endif +#if (defined(__GNUC__) && !defined(__clang__)) && !defined(__INTEL_COMPILER) + #define GCC_COMPILER 1 +#else + #define GCC_COMPILER 0 +#endif +#ifdef __INTEL_COMPILER + #define INTEL_COMPILER 1 +#else + #define INTEL_COMPILER 0 +#endif +#ifndef AMD_COMPILER + #if CLANG_COMPILER + #warning "This suite can't detect the difference between clang and aocc. You need to specify -DAMD_COMPILER={0 or 1}" + #endif + #define AMD_COMPILER 0 +#endif + +#if (defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)) + #define X64_COMPILER 1 +#else + #define X64_COMPILER 0 +#endif +#if (!X64_COMPILER && (defined(_M_X86) || defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_))) + #define X86_COMPILER 1 +#else + #define X86_COMPILER 0 +#endif +#if (defined(__arm__) || defined(__aarch64__) || defined(__thumb__) || defined(_M_ARM) || defined(_M_ARMT) || defined(__ARM_ARCH)) + #define ARM_COMPILER 1 +#else + #define ARM_COMPILER 0 +#endif +#if (ARM_COMPILER && (defined(__thumb__) || defined(_M_ARMT))) + #define ARM_THUMB 1 +#else + #define ARM_THUMB 0 +#endif + +// helper macro function section + +#ifndef max + #define max(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min + #define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#if !(CL_COMPILER) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else + #define likely(x) x + #define unlikely(x) x +#endif + +// constants section + +#define MAX_FACTORIAL_64 20 +#define MAX_FACTORIAL_128 34 +#define MAX_POW_10_16 10000U +#define POW_OF_MAX_POW_10_16 4 +#define MAX_POW_10_32 1000000000UL +#define POW_OF_MAX_POW_10_32 9 +#define MAX_POW_10_64 10000000000000000000ULL +#define POW_OF_MAX_POW_10_64 19 +#define MAX_POW_10_128 ((uintmax_t) MAX_POW_10_64 * (uintmax_t) MAX_POW_10_64) +#define POW_OF_MAX_POW_10_128 38 + +#endif diff --git a/cplusplus/p0000_template.cpp b/cplusplus/p0000_template.cpp new file mode 100644 index 00000000..8e08e86a --- /dev/null +++ b/cplusplus/p0000_template.cpp @@ -0,0 +1,25 @@ +/* +Project Euler Template + +This template is used to format Project Euler solution scripts. This paragraph +should be replaced by a description of how I approached the problem, as well as +critque. + +This paragraph should be replaced by the problem description, excluding images. +*/ +#ifndef EULER_P0000 +#define EULER_P0000 +#include + +unsigned long long p0000() { + return 0; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0000(); + printf("%llu\n", answer); + return 0; +} +#endif +#endif diff --git a/cplusplus/p0001.cpp b/cplusplus/p0001.cpp new file mode 100644 index 00000000..26724a1f --- /dev/null +++ b/cplusplus/p0001.cpp @@ -0,0 +1,40 @@ +/** + * Project Euler Problem 1 + * + * I did this the traditional way in C++, mostly because I want to see if there + * is a way to do iteration in native C++ before hacking together a solution just + * because I can. + * + * Problem: + * + * If we list all the natural numbers below 10 that are multiples of 3 or 5, we + * get 3, 5, 6 and 9. The sum of these multiples is 23. + * + * Find the sum of all the multiples of 3 or 5 below 1000. + */ +#ifndef EULER_P0001 +#define EULER_P0001 +#include + +unsigned long long p0001() { + unsigned long long answer = 0; + for (int i = 0; i < 1000; i += 3) { + answer += i; + } + for (int i = 0; i < 1000; i += 5) { + answer += i; + } + for (int i = 0; i < 1000; i += 15) { + answer -= i; + } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0001(); + printf("%llu\n", answer); + return 0; +} +#endif +#endif diff --git a/cplusplus/requirements.txt b/cplusplus/requirements.txt new file mode 100644 index 00000000..484438c7 --- /dev/null +++ b/cplusplus/requirements.txt @@ -0,0 +1,4 @@ +pytest +pytest-benchmark +sortedcontainers +u-msgpack-python diff --git a/cplusplus/test_euler.py b/cplusplus/test_euler.py new file mode 100644 index 00000000..1e6d3224 --- /dev/null +++ b/cplusplus/test_euler.py @@ -0,0 +1,256 @@ +from atexit import register +from functools import partial +from itertools import chain +from os import environ, listdir, sep +from pathlib import Path +from platform import machine, processor, system, uname +from shutil import rmtree, which +from subprocess import check_call, check_output, run +from sys import path +from tempfile import TemporaryFile +from time import sleep +from typing import List, Set, Union +from uuid import uuid4 +from warnings import warn + +from pytest import fail, fixture, mark, skip, xfail + +CPP_FOLDER = Path(__file__).parent +BUILD_FOLDER = CPP_FOLDER.joinpath('build') +path.append(str(CPP_FOLDER.parent.joinpath("python"))) + +answers = { + 1: 233168, +} + +# this is the set of problems where I have the right answer but wrong solution +known_slow: Set[int] = set() + +# platform variables section +IN_WINDOWS = system() == 'Windows' +IN_OSX = system() == 'Darwin' +IN_TERMUX = bool(which('termux-setup-storage')) +IN_LINUX = (not IN_TERMUX) and (system() == 'Linux') +STANDARDS = ('c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++20') + +if IN_TERMUX: + BUILD_FOLDER = Path.home().joinpath('build') # Termux can't make executable files outside of $HOME + +_raw_NO_SLOW = environ.get('NO_SLOW') +try: + _parsed_NO_SLOW: Union[str, int, None] = int(_raw_NO_SLOW) # type: ignore +except Exception: + _parsed_NO_SLOW = _raw_NO_SLOW +_raw_ONLY_SLOW = environ.get('ONLY_SLOW') +try: + _parsed_ONLY_SLOW: Union[str, int, None] = int(_raw_ONLY_SLOW) # type: ignore +except Exception: + _parsed_ONLY_SLOW = _raw_ONLY_SLOW +_raw_NO_OPTIONAL_TESTS = environ.get('NO_OPTIONAL_TESTS') +try: + _parsed_NO_OPTIONAL_TESTS: Union[str, int, None] = int(_raw_NO_OPTIONAL_TESTS) # type: ignore +except Exception: + _parsed_NO_OPTIONAL_TESTS = _raw_NO_OPTIONAL_TESTS + +if _parsed_NO_SLOW and _parsed_ONLY_SLOW: + warn("Test suite told to ignore slow tests AND run only slow tests. Ignoring conflicing options") + +# if in Termux, default to NO_SLOW, but allow users to explicitly override that decision +NO_SLOW = ((IN_TERMUX and _parsed_NO_SLOW is None) or _parsed_NO_SLOW) and not _parsed_ONLY_SLOW +ONLY_SLOW = _parsed_ONLY_SLOW and not _parsed_NO_SLOW +NO_OPTIONAL_TESTS = (_parsed_NO_OPTIONAL_TESTS is None and ONLY_SLOW) or _parsed_NO_OPTIONAL_TESTS + +# this part isn't necessary, but I like having the binaries include their compile architecture +if IN_LINUX and processor() and ' ' not in processor(): + EXE_EXT = processor() +elif IN_WINDOWS: + # processor() returns something too verbose in Windows + EXE_EXT = "x86" + if machine().endswith('64'): + EXE_EXT += "_64" +elif IN_OSX: + # processor() on OSX returns something too vague to be useful + EXE_EXT = uname().machine.replace('i3', 'x') +elif IN_TERMUX: + # processor() doesn't seem to work on Termux + EXE_EXT = check_output('lscpu').split()[1].decode() +else: + warn("Could not detect system architecture, defaulting to .exe") + EXE_EXT = "exe" + +GCC_BINARY = environ.get('GCC_OVERRIDE', 'g++') +AOCC_BINARY = environ.get('AOCC_OVERRIDE', 'clang') + +# compiler variables section +compilers: List[str] = [] + +if 'COMPILER_OVERRIDE' in environ: + compilers.extend(environ['COMPILER_OVERRIDE'].upper().split(',')) +else: + if not (IN_TERMUX and GCC_BINARY == 'g++') and which(GCC_BINARY): # Termux maps gcc->clang + compilers.extend(f'GCC+{std}' for std in STANDARDS) + if which('clang'): + if b'AOCC' in check_output(['clang', '--version']): + compilers.extend(f'AOCC+{std}' for std in STANDARDS) + else: + compilers.extend(f'CLANG+{std}' for std in STANDARDS) + if AOCC_BINARY != 'clang' and which(AOCC_BINARY): + compilers.extend(f'AOCC+{std}' for std in STANDARDS) + for x in ('icc', 'icc'): + if which(x): + compilers.extend(f'{x.upper()}+{std}' for std in STANDARDS) +if not compilers: + raise RuntimeError("No compilers detected!") + +COMPILER_LEN = len(max(compilers, key=len)) # make sure compiler fixtures are evenly spaced +BUILD_FOLDER.mkdir(parents=True, exist_ok=True) +CL_NO_64 = False +if 'CL' in compilers: + OBJ_FOLDER = BUILD_FOLDER.joinpath('objs') + OBJ_FOLDER.mkdir(exist_ok=True) + _test_file = str(CPP_FOLDER.joinpath('assertions', 'x64_assert.cpp')) + _test_exe = str(BUILD_FOLDER.joinpath('test_cl_64_support.out')) + CL_NO_64 = not (run(['cl', '-Fe:{}'.format(_test_exe), '-Fo{}\\'.format(OBJ_FOLDER), str(_test_file)]).returncode) + +_test_file = str(CPP_FOLDER.joinpath('p0000_template.cpp')) +GCC_NO_64 = False +if EXE_EXT == 'x86_64' and 'GCC' in compilers: + # MingW GCC sometimes doesn't have 64-bit support on 64-bit targets + # not knowing this will make the compiler macro test fail + _test_exe = str(BUILD_FOLDER.joinpath('test_gcc_64_support.out')) + GCC_NO_64 = bool(run([GCC_BINARY, _test_file, '-O0', '-m64', '-o', str(_test_exe)]).returncode) + +CLANG_LINK_MATH = CLANG_ARCH = '' +if not IN_WINDOWS: + CLANG_LINK_MATH = '-lm' +if 'CLANG' in compilers: + _test_exe = str(BUILD_FOLDER.joinpath('test_clang_arch_native.out')) + CLANG_ARCH = '-march=native' * (not run(['clang', _test_file, '-O0', '-march=native', '-o', _test_exe]).returncode) + +SOURCE_TEMPLATE = "{}{}p{{:0>4}}.cpp".format(CPP_FOLDER, sep) +EXE_TEMPLATE = "{}{}p{{:0>4}}.{{}}.{}".format(BUILD_FOLDER, sep, EXE_EXT) +# include sep in the recipe so that Windows won't complain + +GCC_TEMPLATE = "{} {{}} -O2 -lm -Wall -Werror -std={} -march=native -flto -fwhole-program -o {{}}" +if environ.get('COV') == 'true': + GCC_TEMPLATE += ' -ftest-coverage -fprofile-arcs' +CLANG_TEMPLATE = "{} {{}} -O2 {} {} -Wall -Werror -std={} {} -o {{}}" + +templates = {} +for std in STANDARDS: + templates.update({ + f'GCC+{std}': GCC_TEMPLATE.format(GCC_BINARY, std), + f'CLANG+{std}': CLANG_TEMPLATE.format('clang', CLANG_LINK_MATH, CLANG_ARCH, std, '-DAMD_COMPILER=0'), + f'ICC+{std}': GCC_TEMPLATE.format('icc', std), + f'AOCC+{std}': CLANG_TEMPLATE.format(AOCC_BINARY, CLANG_LINK_MATH, CLANG_ARCH, std, '-DAMD_COMPILER=1'), + }) + if std in ('c++14', 'c++17', 'c++20'): + templates[f'CL+{std}'] = "cl -Fe:{{1}} -Fo{}\\ /std:{} -O2 -GL -GF -GW -Brepro -TC {{0}}".format(BUILD_FOLDER.joinpath('objs'), std) + + +@register +def cleanup(): + if 'PYTEST_XDIST_WORKER' not in environ: + rmtree(BUILD_FOLDER) + + +@fixture(params=sorted(x.ljust(COMPILER_LEN) for x in compilers)) +def compiler(request): # type: ignore + return request.param.strip() + + +# to make sure the benchmarks sort correctly +@fixture(params=("{:03}".format(x) for x in sorted(answers))) +def key(request): # type: ignore + return int(request.param) # reduce casting burden on test + + +# to make sure the benchmarks sort correctly +@fixture(params=sorted(chain(listdir(CPP_FOLDER.joinpath("tests")), ("{:03}".format(x) for x in answers)))) +def c_file(request): # type: ignore + try: + return SOURCE_TEMPLATE.format(int(request.param)) + except Exception: + return CPP_FOLDER.joinpath("tests", request.param) + + +@mark.skipif('NO_OPTIONAL_TESTS') +def test_compiler_macros(compiler): + exename = EXE_TEMPLATE.format("test_compiler_macros", compiler) + test_path = CPP_FOLDER.joinpath("tests", "test_compiler_macros.cpp") + check_call(templates[compiler].format(test_path, exename).split()) + buff = check_output([exename]) + flags = [bool(int(x)) for x in buff.split()] + expect_32 = (compiler == 'GCC' and GCC_NO_64) or (compiler == 'CL' and CL_NO_64) + assert flags[0] == compiler.startswith("CL+") + assert flags[1] == compiler.startswith("CLANG") + assert flags[2] == compiler.startswith("GCC") + assert flags[3] == compiler.startswith("ICC") + assert flags[4] == compiler.startswith("AOCC") + assert flags[5] == (EXE_EXT == "x86" or expect_32) + assert flags[6] == (EXE_EXT == "x86_64" and not expect_32) + assert flags[7] == (EXE_EXT not in ("x86", "x86_64", "exe")) + + +@mark.skipif('NO_OPTIONAL_TESTS') +def test_deterministic_build(c_file, compiler): + exename1 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) + exename2 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) + environ['SOURCE_DATE_EPOCH'] = '1' + environ['ZERO_AR_DATE'] = 'true' + check_call(templates[compiler].format(c_file, exename1).split()) + sleep(2) + check_call(templates[compiler].format(c_file, exename2).split()) + try: + with open(exename1, "rb") as f, open(exename2, "rb") as g: + assert f.read() == g.read() + except AssertionError: + if IN_WINDOWS and compiler != 'CL': # mingw gcc doesn't seem to make reproducible builds + xfail() + elif compiler == 'GCC' and environ.get('COV') == 'true': + xfail() # GCC doesn't do reproducible builds w/ code coverage + raise + + +# @mark.skipif('NO_OPTIONAL_TESTS or ONLY_SLOW') +# def test_is_prime(benchmark, compiler): +# from p0007 import is_prime, prime_factors, primes +# MAX_PRIME = 1_000_000 +# exename = EXE_TEMPLATE.format("test_is_prime", compiler) +# test_path = CPP_FOLDER.joinpath("tests", "test_is_prime.cpp") +# args = templates[compiler].format(test_path, exename) + " -DMAX_PRIME={}".format(MAX_PRIME) +# check_call(args.split()) +# with TemporaryFile('wb+') as f: +# run_test = partial(check_call, [exename], stdout=f) +# benchmark.pedantic(run_test, iterations=1, rounds=1) +# prime_cache = tuple(primes(MAX_PRIME)) +# for line in f.readlines(): +# num, prime, composite, idx = (int(x) for x in line.split()) +# assert bool(prime) == bool(is_prime(num)) +# assert bool(composite) == (not is_prime(num)) +# assert composite == 0 or composite == next(iter(prime_factors(num))) +# assert idx == -1 or prime_cache[idx] == num + +# # sometimes benchmark disables itself, so check for .stats +# if hasattr(benchmark, 'stats') and benchmark.stats.stats.max > 200 * MAX_PRIME // 1000000: +# fail("Exceeding 200ns average! (time={}s)".format(benchmark.stats.stats.max)) + + +def test_problem(benchmark, key, compiler): + if (NO_SLOW and key in known_slow) or (ONLY_SLOW and key not in known_slow): + skip() + filename = SOURCE_TEMPLATE.format(key) + exename = EXE_TEMPLATE.format(key, compiler) # need to have both to keep name unique + check_call(templates[compiler].format(filename, exename).split()) + run_test = partial(check_output, [exename]) + + if key in known_slow: + answer = benchmark.pedantic(run_test, iterations=1, rounds=1) + else: + answer = benchmark(run_test) + assert answers[key] == int(answer.strip()) + # sometimes benchmark disables itself, so check for .stats + if hasattr(benchmark, 'stats') and benchmark.stats.stats.median > 60: + fail_func = xfail if key in known_slow else fail + stats = benchmark.stats.stats + fail_func("Exceeding 60s! (Max={:.6}s, Median={:.6}s)".format(stats.max, stats.median)) diff --git a/cplusplus/tests/test_compiler_macros.cpp b/cplusplus/tests/test_compiler_macros.cpp new file mode 100644 index 00000000..eaa4aec5 --- /dev/null +++ b/cplusplus/tests/test_compiler_macros.cpp @@ -0,0 +1,17 @@ +#include +#include "../include/macros.h" + +int main(int argc, char const *argv[]) { + printf( + "%d %d %d %d %d %d %d %d", + CL_COMPILER, + CLANG_COMPILER, + GCC_COMPILER, + INTEL_COMPILER, + AMD_COMPILER, + X86_COMPILER, + X64_COMPILER, + ARM_COMPILER + ); + return 0; +} diff --git a/docs/cplusplus.rst b/docs/cplusplus.rst new file mode 100644 index 00000000..87485f01 --- /dev/null +++ b/docs/cplusplus.rst @@ -0,0 +1,33 @@ +Euler C++ Implementation +====================== + +.. include:: ../cplusplus/README.rst + :start-line: 2 + :end-before: Problems Solved + +Library Code +------------ + +.. toctree:: + :glob: + :numbered: + :maxdepth: 1 + + cplusplus/bcd + cplusplus/digits + cplusplus/factors + cplusplus/fibonacci + cplusplus/iterator + cplusplus/macros + cplusplus/math + cplusplus/primes + +Problems Solved +--------------- + +.. toctree:: + :glob: + :numbered: + :maxdepth: 1 + + cplusplus/p[0-9][0-9][0-9][0-9] diff --git a/docs/cplusplus/p0001.rst b/docs/cplusplus/p0001.rst new file mode 100644 index 00000000..4aa262a9 --- /dev/null +++ b/docs/cplusplus/p0001.rst @@ -0,0 +1,8 @@ +C++ Implementation of Problem 1 +=============================== + +View source code `here on GitHub! `_ + +.. literalinclude:: ../../cplusplus/p0001.cpp + :language: C++ + :linenos: diff --git a/docs/index.rst b/docs/index.rst index 3aaab0fb..cff294ee 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -72,6 +72,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` .. |C| replace:: **C** +.. |Cp| replace:: **C++** .. |C#| replace:: **C#** .. |Js| replace:: **JavaScript** .. |Py| replace:: **Python** @@ -87,163 +88,164 @@ This project is divided into several Makefiles, connected by a root Makefile whi .. rst-class:: centertable -+-----------+------+------+------+------+------+ -| | |C| | |C#| | |Js| | |Py| | |Rs| | -+===========+======+======+======+======+======+ -|Coverage | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|Docs | |ip| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|Linting | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|Testing | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -+-----------+------+------+------+------+------+ -|:prob:`1` | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`2` | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`3` | |d| | | | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`4` | |d| | | | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`5` | |d| | | | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`6` | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`7` | |d| | | | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`8` | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`9` | |d| | |d| | |d| | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`10` | |d| | | | |d| | |d| | -+-----------+------+------+------+------+------+ -|:prob:`11` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`12` | |ip| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`13` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`14` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`15` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`16` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`17` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`18` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`19` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`20` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`21` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`22` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`23` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`24` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`25` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`27` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`29` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`30` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`31` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`32` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`33` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`34` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`35` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`36` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`37` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`38` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`39` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`40` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`41` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`42` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`43` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`44` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`45` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`46` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`47` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`48` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`49` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`50` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`52` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`53` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`55` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`56` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`57` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`59` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`67` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`69` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`71` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`73` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`74` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`76` | |d| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`77` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`87` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`92` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`97` | | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`118`| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`123`| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`134`| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`145`| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`187`| | | | |d| | | -+-----------+------+------+------+------+------+ -|:prob:`206`| | | | |d| | | -+-----------+------+------+------+------+------+ ++-----------+------+------+------+------+------+------+ +| | |C| | |Cp| | |C#| | |Js| | |Py| | |Rs| | ++===========+======+======+======+======+======+======+ +|Coverage | |d| | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|Docs | |ip| | |ip| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|Linting | |d| | |ip| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|Testing | |d| | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ ++-----------+------+------+------+------+------+------+ +|:prob:`1` | |d| | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`2` | |d| | | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`3` | |d| | | | | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`4` | |d| | | | | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`5` | |d| | | | | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`6` | |d| | | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`7` | |d| | | | | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`8` | |d| | | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`9` | |d| | | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`10` | |d| | | | | |d| | |d| | ++-----------+------+------+------+------+------+------+ +|:prob:`11` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`12` | |ip| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`13` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`14` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`15` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`16` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`17` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`18` | | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`19` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`20` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`21` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`22` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`23` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`24` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`25` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`27` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`29` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`30` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`31` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`32` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`33` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`34` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`35` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`36` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`37` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`38` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`39` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`40` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`41` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`42` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`43` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`44` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`45` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`46` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`47` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`48` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`49` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`50` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`52` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`53` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`55` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`56` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`57` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`59` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`67` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`69` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`71` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`73` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`74` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`76` | |d| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`77` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`87` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`92` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`97` | | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`118`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`123`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`134`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`145`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`187`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ +|:prob:`206`| | | | | |d| | | ++-----------+------+------+------+------+------+------+ .. toctree:: :maxdepth: 2 c + cplusplus csharp javascript python From 30123b20043156ca735156243953dfa5fdd06832 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:11:37 -0500 Subject: [PATCH 313/326] Add C# solution for problem 4 --- README.rst | 2 +- csharp/Euler.Test/test.cs | 1 + csharp/Euler/p0004.cs | 48 +++++++++++++++++++++++++++++++++++++++ docs/csharp/p0004.rst | 16 +++++++++++++ docs/index.rst | 2 +- 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 csharp/Euler/p0004.cs create mode 100644 docs/csharp/p0004.rst diff --git a/README.rst b/README.rst index 6102dbd5..b5e8ad13 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------+---------------+ | C++ | C++98+ | 1 | |Cpi| | +------------+---------------------+--------+---------------+ -| C# | .NET 2+ | 5 | |C#i| | +| C# | .NET 2+ | 6 | |C#i| | +------------+---------------------+--------+---------------+ | JavaScript | Node 12+ | 5 | |JavaScript| | +------------+---------------------+--------+---------------+ diff --git a/csharp/Euler.Test/test.cs b/csharp/Euler.Test/test.cs index 23e81e9a..3ec8cfa3 100644 --- a/csharp/Euler.Test/test.cs +++ b/csharp/Euler.Test/test.cs @@ -10,6 +10,7 @@ public static IEnumerable Data() yield return new object[] { typeof(p0000), 0 }; yield return new object[] { typeof(p0001), 233168 }; yield return new object[] { typeof(p0002), 4613732 }; + yield return new object[] { typeof(p0004), 906609 }; yield return new object[] { typeof(p0006), 25164150 }; yield return new object[] { typeof(p0008), 23514624000 }; yield return new object[] { typeof(p0009), 31875000 }; diff --git a/csharp/Euler/p0004.cs b/csharp/Euler/p0004.cs new file mode 100644 index 00000000..c6ffcf66 --- /dev/null +++ b/csharp/Euler/p0004.cs @@ -0,0 +1,48 @@ +/* +Project Euler Problem 4 + +I couldn't figure out how to do this as efficiently as I would have liked. I am +SURE that there is a better way to check if a number is a palindrome, but I +could not think of one. + +Problem: + +A palindromic number reads the same both ways. The largest palindrome made from +the product of two 2-digit numbers is 9009 = 91 × 99. + +Find the largest palindrome made from the product of two 3-digit numbers. +*/ +using System; + +namespace Euler +{ + public class p0004 : IEuler + { + private static string Reverse( string s ) + { + char[] charArray = s.ToCharArray(); + Array.Reverse(charArray); + return new string(charArray); + } + + private static bool IsPalindrome( Int64 x ) + { + string rep = x.ToString(); + return rep == Reverse(rep); + } + + public Task Answer() + { + Int64 answer = 0; + for (int v = 101; v < 1000; v++) { + for (int u = 100; u < v; u++) { + Int64 p = u * v; + if (IsPalindrome(p) && p > answer) { + answer = p; + } + } + } + return Task.FromResult(answer); + } + } +} diff --git a/docs/csharp/p0004.rst b/docs/csharp/p0004.rst new file mode 100644 index 00000000..9faa2af6 --- /dev/null +++ b/docs/csharp/p0004.rst @@ -0,0 +1,16 @@ +C# Implementation of Problem 4 +============================== + +View source code `here on GitHub! `_ + +.. csharp:namespace:: Euler + +.. csharp:class:: p0004 + + .. csharp:inherits:: Euler.IEuler + + .. csharp:method:: Task Answer() + +.. literalinclude:: ../../csharp/Euler/p0004.cs + :language: csharp + :linenos: diff --git a/docs/index.rst b/docs/index.rst index cff294ee..7d5c832f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -106,7 +106,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+------+ |:prob:`3` | |d| | | | | |d| | |d| | +-----------+------+------+------+------+------+------+ -|:prob:`4` | |d| | | | | |d| | |d| | +|:prob:`4` | |d| | | |d| | | |d| | |d| | +-----------+------+------+------+------+------+------+ |:prob:`5` | |d| | | | | |d| | |d| | +-----------+------+------+------+------+------+------+ From 4f3764eb81181baa0f76a33541af6c43af686e31 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:12:21 -0500 Subject: [PATCH 314/326] Correct makefile error --- rust/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/Makefile b/rust/Makefile index a250bc14..01c3530c 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -10,7 +10,7 @@ test: cargo test -j 1 test_auto: - cargo test -j default + cargo test test_%: cargo test -j $* From f848f79f203ef7edf3ced900885744a7d25ac424 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:17:27 -0500 Subject: [PATCH 315/326] Remove test_deterministic_build It's a huge pain to maintain, and it doesn't seem to work well in Github Actions --- c/test_euler.py | 22 ---------------------- cplusplus/test_euler.py | 20 -------------------- 2 files changed, 42 deletions(-) diff --git a/c/test_euler.py b/c/test_euler.py index 397c94a2..94832ff2 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -219,28 +219,6 @@ def test_compiler_macros(compiler): assert flags[9] == (EXE_EXT not in ("x86", "x86_64", "exe")) -@mark.skipif('NO_OPTIONAL_TESTS') -def test_deterministic_build(c_file, compiler): - exename1 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) - exename2 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) - environ['SOURCE_DATE_EPOCH'] = '1' - environ['ZERO_AR_DATE'] = 'true' - check_call(templates[compiler].format(c_file, exename1).split()) - sleep(2) - check_call(templates[compiler].format(c_file, exename2).split()) - try: - with open(exename1, "rb") as f, open(exename2, "rb") as g: - assert f.read() == g.read() - except AssertionError: - if IN_WINDOWS and compiler != 'CL': # mingw gcc doesn't seem to make reproducible builds - xfail() - elif compiler == 'PCC': - xfail() # PCC doesn't allow reproducible builds with static keyword - elif compiler == 'GCC' and environ.get('COV') == 'true': - xfail() # GCC doesn't do reproducible builds w/ code coverage - raise - - @mark.skipif('NO_OPTIONAL_TESTS or ONLY_SLOW') def test_is_prime(benchmark, compiler): from p0007 import is_prime, prime_factors, primes diff --git a/cplusplus/test_euler.py b/cplusplus/test_euler.py index 1e6d3224..c7e82270 100644 --- a/cplusplus/test_euler.py +++ b/cplusplus/test_euler.py @@ -192,26 +192,6 @@ def test_compiler_macros(compiler): assert flags[7] == (EXE_EXT not in ("x86", "x86_64", "exe")) -@mark.skipif('NO_OPTIONAL_TESTS') -def test_deterministic_build(c_file, compiler): - exename1 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) - exename2 = EXE_TEMPLATE.format("dbuild{}".format(uuid4()), compiler) - environ['SOURCE_DATE_EPOCH'] = '1' - environ['ZERO_AR_DATE'] = 'true' - check_call(templates[compiler].format(c_file, exename1).split()) - sleep(2) - check_call(templates[compiler].format(c_file, exename2).split()) - try: - with open(exename1, "rb") as f, open(exename2, "rb") as g: - assert f.read() == g.read() - except AssertionError: - if IN_WINDOWS and compiler != 'CL': # mingw gcc doesn't seem to make reproducible builds - xfail() - elif compiler == 'GCC' and environ.get('COV') == 'true': - xfail() # GCC doesn't do reproducible builds w/ code coverage - raise - - # @mark.skipif('NO_OPTIONAL_TESTS or ONLY_SLOW') # def test_is_prime(benchmark, compiler): # from p0007 import is_prime, prime_factors, primes From 3283ce3e66c25baa42da83b9c74da7cf21101fb0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:19:56 -0500 Subject: [PATCH 316/326] Fix malformed table --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 7d5c832f..7cfb09de 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -134,7 +134,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+------+ |:prob:`17` | | | | | |d| | | +-----------+------+------+------+------+------+------+ -|:prob:`18` | | | | | | |d| | | +|:prob:`18` | | | | | |d| | | +-----------+------+------+------+------+------+------+ |:prob:`19` | | | | | |d| | | +-----------+------+------+------+------+------+------+ From 397a0ebfe9d1b41821d3c849d88483f2fc9a5dcc Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:23:58 -0500 Subject: [PATCH 317/326] `dotnet format` --- csharp/Euler/p0004.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/csharp/Euler/p0004.cs b/csharp/Euler/p0004.cs index c6ffcf66..6cb610cd 100644 --- a/csharp/Euler/p0004.cs +++ b/csharp/Euler/p0004.cs @@ -18,14 +18,14 @@ namespace Euler { public class p0004 : IEuler { - private static string Reverse( string s ) + private static string Reverse(string s) { char[] charArray = s.ToCharArray(); Array.Reverse(charArray); return new string(charArray); } - private static bool IsPalindrome( Int64 x ) + private static bool IsPalindrome(Int64 x) { string rep = x.ToString(); return rep == Reverse(rep); @@ -34,10 +34,13 @@ private static bool IsPalindrome( Int64 x ) public Task Answer() { Int64 answer = 0; - for (int v = 101; v < 1000; v++) { - for (int u = 100; u < v; u++) { + for (int v = 101; v < 1000; v++) + { + for (int u = 100; u < v; u++) + { Int64 p = u * v; - if (IsPalindrome(p) && p > answer) { + if (IsPalindrome(p) && p > answer) + { answer = p; } } From 37027d7c6abd83ae9586ee60b68a32f4b8f553b5 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 14:58:06 -0500 Subject: [PATCH 318/326] Fix COMPILER_OVERRIDE variables, C++ lint --- .github/workflows/cplusplus.yml | 2 +- c/test_euler.py | 6 +++++- cplusplus/test_euler.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml index 24a5c346..111e50bf 100644 --- a/.github/workflows/cplusplus.yml +++ b/.github/workflows/cplusplus.yml @@ -27,7 +27,7 @@ jobs: version: 1.0 - name: Run tests - run: make cpp_lint + run: make cp_lint cpp: strategy: diff --git a/c/test_euler.py b/c/test_euler.py index 94832ff2..00d7e319 100644 --- a/c/test_euler.py +++ b/c/test_euler.py @@ -104,7 +104,11 @@ compilers: List[str] = [] if 'COMPILER_OVERRIDE' in environ: - compilers.extend(environ['COMPILER_OVERRIDE'].upper().split(',')) + for comp in environ['COMPILER_OVERRIDE'].upper().split(','): + if comp in ('pcc', 'tcc'): + compilers.append(comp) + else: + compilers.extend(f'{comp}+{std}' for std in STANDARDS) else: if not (IN_TERMUX and GCC_BINARY == 'gcc') and which(GCC_BINARY): # Termux maps gcc->clang compilers.extend(f'GCC+{std}' for std in STANDARDS) diff --git a/cplusplus/test_euler.py b/cplusplus/test_euler.py index c7e82270..0f744492 100644 --- a/cplusplus/test_euler.py +++ b/cplusplus/test_euler.py @@ -85,7 +85,8 @@ compilers: List[str] = [] if 'COMPILER_OVERRIDE' in environ: - compilers.extend(environ['COMPILER_OVERRIDE'].upper().split(',')) + for comp in environ['COMPILER_OVERRIDE'].upper().split(','): + compilers.extend(f'{comp}+{std}' for std in STANDARDS) else: if not (IN_TERMUX and GCC_BINARY == 'g++') and which(GCC_BINARY): # Termux maps gcc->clang compilers.extend(f'GCC+{std}' for std in STANDARDS) From a4659207bafdcc7e39f1efa5f20b22b7bc1d0150 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 15:05:20 -0500 Subject: [PATCH 319/326] Fix more makefile references --- .github/workflows/cplusplus.yml | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml index 111e50bf..d6375f6b 100644 --- a/.github/workflows/cplusplus.yml +++ b/.github/workflows/cplusplus.yml @@ -76,15 +76,15 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make c_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} COV=true + run: make cp_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} COV=true - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} - run: make c_test_auto + run: make cp_test_auto - name: Run tests (macos) if: ${{ contains(matrix.os, 'macos') }} - run: make c_test_auto + run: make cp_test_auto env: NO_OPTIONAL_TESTS: true COMPILER_OVERRIDE: clang diff --git a/Makefile b/Makefile index d1b1dcc1..053e9ed5 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ cs_%: @cd csharp && $(MAKE) $* $(MFLAGS) cp_%: - @cd csharp && $(MAKE) $* $(MFLAGS) + @cd cplusplus && $(MAKE) $* $(MFLAGS) c_%: @cd c && $(MAKE) $* $(MFLAGS) From a157716862157497b7d36e29235f6b95e1287a69 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 15:10:09 -0500 Subject: [PATCH 320/326] Remove ubuntu-20.04, unused compilers --- .github/workflows/cplusplus.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml index d6375f6b..0df18364 100644 --- a/.github/workflows/cplusplus.yml +++ b/.github/workflows/cplusplus.yml @@ -34,8 +34,8 @@ jobs: fail-fast: false matrix: # compiler: ["llvm", "gcc"] -# # compiler targets (ideally): clang, gcc, MSVCC, pcc, tcc, icc, - os: [ubuntu-latest, windows-latest, macos-latest, macos-13, 'ubuntu-20.04'] +# # compiler targets (ideally): clang, gcc, MSVCC, icc, + os: [ubuntu-latest, windows-latest, macos-latest, macos-13] # include: # - os: windows-latest # compiler: msvc @@ -54,13 +54,6 @@ jobs: python-version: "3.10" cache-dependency-path: '*/requirements.txt' - - name: Setup tcc, pcc - uses: awalsh128/cache-apt-pkgs-action@latest - if: ${{ matrix.os == 'ubuntu-latest' }} - with: - packages: tcc pcc - version: 1.0 - - name: Setup MSVC uses: aminya/setup-cpp@v1 if: ${{ contains(matrix.os, 'windows') }} @@ -76,7 +69,7 @@ jobs: - name: Run tests (linux) if: ${{ contains(matrix.os, 'ubuntu') }} - run: make cp_test${{ (matrix.os != 'ubuntu-latest' && '_auto') || '' }} COV=true + run: make cp_test COV=true - name: Run tests (windows) if: ${{ contains(matrix.os, 'windows') }} From 686ba3ff92eb56be5ed232b926fc09695bf40c77 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 16:42:21 -0500 Subject: [PATCH 321/326] Update READMEs, add to filter, split off python-lint --- .github/workflows/c.yml | 1 + .github/workflows/codeql.yml | 1 + .github/workflows/cplusplus.yml | 1 + .github/workflows/csharp.yml | 1 + .github/workflows/eslint.yml | 1 + .github/workflows/javascript.yml | 3 +- .github/workflows/python-lint.yml | 32 ++++++ .github/workflows/python.yml | 18 +--- .github/workflows/rust-clippy.yml | 3 +- .github/workflows/rust.yml | 1 + README.rst | 63 ++++++------ cplusplus/README.rst | 158 ++++++++++++++++++++++++++++++ csharp/README.rst | 6 ++ docs/index.rst | 2 +- javascript/README.rst | 3 + rust/README.rst | 11 ++- 16 files changed, 255 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/python-lint.yml create mode 100644 cplusplus/README.rst diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml index 9e733a46..5e3b67c8 100644 --- a/.github/workflows/c.yml +++ b/.github/workflows/c.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f3409efb..9eb0dbd1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,6 +20,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' branches: [ "master" ] pull_request: branches: [ "master" ] diff --git a/.github/workflows/cplusplus.yml b/.github/workflows/cplusplus.yml index 0df18364..ea4c2bdd 100644 --- a/.github/workflows/cplusplus.yml +++ b/.github/workflows/cplusplus.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 2de452a6..27596947 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 002e015b..898a7e74 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -14,6 +14,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' branches: [ "master" ] pull_request: # The branches below must be a subset of the branches above diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index f6b918e4..c0e7ef2b 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -5,13 +5,14 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: javascript: strategy: diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml new file mode 100644 index 00000000..09fe2aea --- /dev/null +++ b/.github/workflows/python-lint.yml @@ -0,0 +1,32 @@ +name: Python-Lint + +on: + push: + paths-ignore: + - 'docs/**' + - 'README.rst' + - '**/README.rst' + schedule: + - cron: "0 0 1 * *" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + python-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Use Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + cache: 'pip' + cache-dependency-path: | + python/requirements.txt + c/requirements.txt + + - name: Lint + run: make pytest LINT=only diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 52c69b1c..33f376f1 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" @@ -13,23 +14,6 @@ concurrency: cancel-in-progress: true jobs: -# python-lint: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# -# - name: Use Python 3.12 -# uses: actions/setup-python@v5 -# with: -# python-version: 3.12 -# cache: 'pip' -# cache-dependency-path: | -# python/requirements.txt -# c/requirements.txt -# -# - name: Lint -# run: make pytest LINT=only - python: strategy: fail-fast: false diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 2fa6b8af..36e766cd 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -14,6 +14,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' branches: [ "master" ] pull_request: # The branches below must be a subset of the branches above @@ -24,7 +25,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: rust-clippy-analyze: name: Run rust-clippy analyzing diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 42a12a9e..c623fa7b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - 'README.rst' + - '**/README.rst' schedule: - cron: "0 0 1 * *" diff --git a/README.rst b/README.rst index b5e8ad13..208be20b 100644 --- a/README.rst +++ b/README.rst @@ -19,6 +19,8 @@ LivInTheLookingGlass’s Project Euler solutions :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml .. |RustClippy| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml +.. |PythonLint| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python-lint.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python-lint.yml .. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml .. |Coverage| image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graph/badge.svg?token=6GHBNILEHG @@ -26,35 +28,38 @@ LivInTheLookingGlass’s Project Euler solutions .. |br| raw:: html
- -+------------+---------------------+--------+---------------+ -| Language | Version | Solved | Status | -+============+=====================+========+===============+ -| C | C99+ in: ``gcc``, | 17 | |Ci| | -| | |br| ``clang``, | | | -| | ``msvc``, |br| | | | -| | ``pcc``, ``tcc`` | | | -+------------+---------------------+--------+---------------+ -| C++ | C++98+ | 1 | |Cpi| | -+------------+---------------------+--------+---------------+ -| C# | .NET 2+ | 6 | |C#i| | -+------------+---------------------+--------+---------------+ -| JavaScript | Node 12+ | 5 | |JavaScript| | -+------------+---------------------+--------+---------------+ -| Python | CPython 3.6+ |br| | 70 | |Python| | -| | Pypy 3.6+ |br| | | | -| | GraalPy 23.1+ | | | -+------------+---------------------+--------+---------------+ -| Rust | 1.69+ | 10 | |Rust| | -+------------+---------------------+--------+---------------+ -| Documentation (in progress) | |Pages| | -+-------------------------------------------+---------------+ -| Code Coverage | |Coverage| | -+-------------------------------------------+---------------+ -| Code Scanning | |CodeQL| |br| | -| | |ESLint| |br| | -| | |RustClippy| | -+-------------------------------------------+---------------+ + ++------------+---------------------+--------+-------------------+ +| Language | Version | Solved | Status | ++============+=====================+========+===================+ +| C | C99+ in: ``gcc``, | 17 | |Ci| | +| | |br| ``clang``, | | | +| | ``msvc``, |br| | | | +| | ``pcc``, ``tcc`` | | | ++------------+---------------------+--------+-------------------+ +| C++ | C++98+ in ``g++`` | 1 | |Cpi| | +| | |br| ``clang``, | | | +| | ``msvc`` | | | ++------------+---------------------+--------+-------------------+ +| C# | .NET 2+ | 6 | |C#i| | ++------------+---------------------+--------+-------------------+ +| JavaScript | Node 12+ | 5 | |JavaScript| | ++------------+---------------------+--------+-------------------+ +| Python | CPython 3.6+ |br| | 70 | |Python| | +| | Pypy 3.6+ |br| | | | +| | GraalPy 23.1+ | | | ++------------+---------------------+--------+-------------------+ +| Rust | 1.69+ | 10 | |Rust| | ++------------+---------------------+--------+-------------------+ +| Documentation (in progress) | |Pages| | ++-------------------------------------------+-------------------+ +| Code Coverage | |Coverage| | ++-------------------------------------------+-------------------+ +| Code Scanning | |CodeQL| |br| | +| | |ESLint| |br| | +| | |PythonLint| |br| | +| | |RustClippy| | ++-------------------------------------------+-------------------+ Coverage -------- diff --git a/cplusplus/README.rst b/cplusplus/README.rst new file mode 100644 index 00000000..b844f0f5 --- /dev/null +++ b/cplusplus/README.rst @@ -0,0 +1,158 @@ +C++ Section +=========== + +.. |C++ Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml/badge.svg + :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml + +|C++ Check| + +All problems are solved in C++98. It is tested on clang, g++, and msvc (the Visual Studios compiler). + +Organization +------------ + +All C++ files share a common prefix with their problem number. All shared +functions are moved to header files in the include subfolder + +Makefile +-------- + +There are three main recipes in this Makefile + +dependencies +~~~~~~~~~~~~ + +This recipe installs all the required and test dependencies. See the +Dependencies section for more info + +test +~~~~ + +This recipe runs tests in a single thread and performs benchmarks on +each. This test infrastructure is recycled from the python section. + +test\_\* +~~~~~~~~ + +This recipe runs tests in multiple threads, using however many are +specified by the number after the \_. For example, ``test_3`` would +spawn three python processes. Because benchmark disables itself when +running in children processes, benchmark info is not available with this +recipe. + +Tests +----- + +Compiler Detection Macros +~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a set of macros which detect which compiler is being used. +These macros are mostly used to route around issues with particular +compilers. For instance, PCC does not allow me to include ```` +or ```` on the systems I've tested it on, so I need to route +around that. This test checks that those macros are correct. + +Prime Infrastructure Test +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This test checks five things: + +1. It checks ``is_prime()`` for numbers up to ``MAX_PRIME``, where that + is defined in the test +2. It checks that ``is_composite()`` returns truthy values on composites + in that range, and falsey values on primes +3. It checks that ``is_composite()`` returns the smallest prime factor + on composite numbers +4. It checks that the prime numbers are generated in the correct order +5. It checks that all these operations are completed in less than 200ns + \* ``MAX_PRIME`` + +Generic Problems +~~~~~~~~~~~~~~~~ + +For each problem it will check the answer against a known dictionary. If +the problem is not in the "known slow" category (meaning that I generate +the correct answer with a poor solution), it will run it as many times +as the benchmark plugin wants. Otherwise it is run exactly once. + +A test fails if it gets the wrong answer or if it takes more than 1 +minute. + +Dependencies +------------ + +I try to keep the dependencies of this project as small as possible, +except for test plugins. At the moment there are no non-test +dependencies for this section. + +Note that there are optional test that leverage the Python +infrastructure. If you want these tests to work you need to go to the +python folder and run ``make dependencies`` or define the +`NO_OPTIONAL_TESTS <#no-slow-tests>`__ environment variable. + +Environment Variables +--------------------- + +COMPILER_OVERRIDE +~~~~~~~~~~~~~~~~~ + +If this variable is defined, it should contain a comma-separated list of +the compilers you would like to test from the following list (case +insensitive): + +- aocc (AMD Optimized C Compiler) +- cl (Visual Studios compiler) +- clang +- gcc +- icc (Intel C Compiler) +- pcc (Portable C Compiler) +- tcc (Tiny C Compiler) + +If this variable is not defined, compilers will be auto-detected using +``which()``. + +AOCC_OVERRIDE +~~~~~~~~~~~~~ + +If this variable is defined, it should hold a string representing the +AMD compiler binary you would like to use. One case you may want this in +is to test both the AMD compiler and traditional clang by renaming the +AMD compiler's executable. + +GCC_OVERRIDE +~~~~~~~~~~~~ + +If this variable is defined, it should hold a string representing the +``gcc`` binary you would like to use. One case you may want this in is +on OSX or Termux, where ``gcc`` is often remapped to ``clang``. + +NO_OPTIONAL_TESTS +~~~~~~~~~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, the test suite will skip any tests which are not directly +related to Project Euler problems. This value will default to the same +value as `ONLY_SLOW <#only-slow>`__. + +NO_SLOW +~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, problems in the known_slow group will not be tested. This +variable defaults to True on Termux systems. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +ONLY_SLOW +~~~~~~~~~ + +If this variable is defined to something other than 0 or an empty +string, *only* problems in the known_slow group will be tested. If both +`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are +truthy, they will be ignored and a warning will be issued. + +Problems Solved +--------------- + +- ☒ `1 <./p0001.cpp>`__ + diff --git a/csharp/README.rst b/csharp/README.rst index 3b042ba5..cbd85897 100644 --- a/csharp/README.rst +++ b/csharp/README.rst @@ -77,3 +77,9 @@ Problems Solved --------------- - ☒ `1 <./p0001.cs>`__ +- ☒ `2 <./p0002.cs>`__ +- ☒ `4 <./p0004.cs>`__ +- ☒ `6 <./p0006.cs>`__ +- ☒ `8 <./p0008.cs>`__ +- ☒ `9 <./p0009.cs>`__ + diff --git a/docs/index.rst b/docs/index.rst index 7cfb09de..ee1f96e5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -91,7 +91,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+------+ | | |C| | |Cp| | |C#| | |Js| | |Py| | |Rs| | +===========+======+======+======+======+======+======+ -|Coverage | |d| | |d| | |d| | |d| | |d| | |d| | +|Coverage | |d| | |ip| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+------+ |Docs | |ip| | |ip| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+------+ diff --git a/javascript/README.rst b/javascript/README.rst index b621546d..050898a0 100644 --- a/javascript/README.rst +++ b/javascript/README.rst @@ -76,3 +76,6 @@ Problems Solved - ☒ `1 <./p0001.js>`__ - ☒ `2 <./p0002.js>`__ +- ☒ `6 <./p0002.js>`__ +- ☒ `8 <./p0002.js>`__ +- ☒ `9 <./p0002.js>`__ diff --git a/rust/README.rst b/rust/README.rst index 22fd4400..d67e8764 100644 --- a/rust/README.rst +++ b/rust/README.rst @@ -58,5 +58,14 @@ dependencies for this section. Problems Solved --------------- -- ☒ `1 <./p0001.rs>`__ +- ☒ `1 <./src/p0001.rs>`__ +- ☒ `2 <./src/p0002.rs>`__ +- ☒ `3 <./src/p0003.rs>`__ +- ☒ `4 <./src/p0004.rs>`__ +- ☒ `5 <./src/p0005.rs>`__ +- ☒ `6 <./src/p0006.rs>`__ +- ☒ `7 <./src/p0007.rs>`__ +- ☒ `8 <./src/p0008.rs>`__ +- ☒ `9 <./src/p0009.rs>`__ +- ☒ `10 <./src/p0010.rs>`__ From f7da933a7625f551f1de037256b1752bfee1a34d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 16:49:00 -0500 Subject: [PATCH 322/326] fix command --- .github/workflows/python-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 09fe2aea..dc48b605 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -29,4 +29,4 @@ jobs: c/requirements.txt - name: Lint - run: make pytest LINT=only + run: make py_test LINT=only From cd8ed70296718799be888ae426e78cdbb7d392b4 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 16:51:37 -0500 Subject: [PATCH 323/326] update table line layout --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 208be20b..458fb8b0 100644 --- a/README.rst +++ b/README.rst @@ -37,8 +37,8 @@ LivInTheLookingGlass’s Project Euler solutions | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+-------------------+ -| C++ | C++98+ in ``g++`` | 1 | |Cpi| | -| | |br| ``clang``, | | | +| C++ | C++98+ in |br| | 1 | |Cpi| | +| | ``g++``, ``clang``, | | | | | ``msvc`` | | | +------------+---------------------+--------+-------------------+ | C# | .NET 2+ | 6 | |C#i| | From 16d4eb27ccb178ffcfb5f27205dfd1332f06d3ca Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 18:45:10 -0500 Subject: [PATCH 324/326] reorder compilers --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 458fb8b0..80c1100f 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,7 @@ LivInTheLookingGlass’s Project Euler solutions | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+-------------------+ | C++ | C++98+ in |br| | 1 | |Cpi| | -| | ``g++``, ``clang``, | | | +| | ``clang``, ``g++``, | | | | | ``msvc`` | | | +------------+---------------------+--------+-------------------+ | C# | .NET 2+ | 6 | |C#i| | From 22bc13e1810a895112dcd86508e61ad040041d4b Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 20:40:18 -0500 Subject: [PATCH 325/326] try to make code enforce nowrap --- README.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 80c1100f..5a715dfa 100644 --- a/README.rst +++ b/README.rst @@ -29,6 +29,12 @@ LivInTheLookingGlass’s Project Euler solutions
+.. raw:: html + + + +------------+---------------------+--------+-------------------+ | Language | Version | Solved | Status | +============+=====================+========+===================+ @@ -38,7 +44,7 @@ LivInTheLookingGlass’s Project Euler solutions | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+-------------------+ | C++ | C++98+ in |br| | 1 | |Cpi| | -| | ``clang``, ``g++``, | | | +| | ``g++``, ``clang``, | | | | | ``msvc`` | | | +------------+---------------------+--------+-------------------+ | C# | .NET 2+ | 6 | |C#i| | From 13fcf3c3913aefb27a65ddc05d20969121f9bbbb Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Fri, 19 Jul 2024 21:56:54 -0500 Subject: [PATCH 326/326] add solution 2 in C++, tweak docs --- README.rst | 4 ++-- cplusplus/README.rst | 1 + cplusplus/p0002.cpp | 45 ++++++++++++++++++++++++++++++++++++++++ cplusplus/test_euler.py | 5 +++-- docs/cplusplus/p0002.rst | 8 +++++++ docs/index.rst | 2 +- 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 cplusplus/p0002.cpp create mode 100644 docs/cplusplus/p0002.rst diff --git a/README.rst b/README.rst index 5a715dfa..64ab720c 100644 --- a/README.rst +++ b/README.rst @@ -43,8 +43,8 @@ LivInTheLookingGlass’s Project Euler solutions | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------+-------------------+ -| C++ | C++98+ in |br| | 1 | |Cpi| | -| | ``g++``, ``clang``, | | | +| C++ | C++98+ in |br| | 2 | |Cpi| | +| | ``gcc``, ``clang``, | | | | | ``msvc`` | | | +------------+---------------------+--------+-------------------+ | C# | .NET 2+ | 6 | |C#i| | diff --git a/cplusplus/README.rst b/cplusplus/README.rst index b844f0f5..d4e841e2 100644 --- a/cplusplus/README.rst +++ b/cplusplus/README.rst @@ -155,4 +155,5 @@ Problems Solved --------------- - ☒ `1 <./p0001.cpp>`__ +- ☒ `2 <./p0002.cpp>`__ diff --git a/cplusplus/p0002.cpp b/cplusplus/p0002.cpp new file mode 100644 index 00000000..87f2389b --- /dev/null +++ b/cplusplus/p0002.cpp @@ -0,0 +1,45 @@ +/* +Project Euler Problem 2 + +Again, see Python implementation for a proof + +Problem: + +Each new term in the Fibonacci sequence is generated by adding the previous two +terms. By starting with 1 and 2, the first 10 terms will be: + +1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + +By considering the terms in the Fibonacci sequence whose values do not exceed +four million, find the sum of the even-valued terms. +*/ + +#ifndef EULER_P0002 +#define EULER_P0002 +#include + +unsigned long long p0002() { + unsigned long long answer = 0, + a = 1, b = 2, t; + while (b < 4000000) { + // odd (1, 3, 13, 55, ...) + // odd (1, 5, 21, 89, ...) + // even (2, 8, 34, 144, ...) + answer += b; + for (unsigned char z = 0; z < 3; z++) { + t = b; + b = a + b; + a = t; + } + } + return answer; +} + +#ifndef UNITY_END +int main(int argc, char const *argv[]) { + unsigned long long answer = p0002(); + printf("%llu\n", answer); + return 0; +} +#endif +#endif diff --git a/cplusplus/test_euler.py b/cplusplus/test_euler.py index 0f744492..9e84b59e 100644 --- a/cplusplus/test_euler.py +++ b/cplusplus/test_euler.py @@ -21,6 +21,7 @@ answers = { 1: 233168, + 2: 4613732, } # this is the set of problems where I have the right answer but wrong solution @@ -78,7 +79,7 @@ warn("Could not detect system architecture, defaulting to .exe") EXE_EXT = "exe" -GCC_BINARY = environ.get('GCC_OVERRIDE', 'g++') +GCC_BINARY = environ.get('GCC_OVERRIDE', 'gcc') AOCC_BINARY = environ.get('AOCC_OVERRIDE', 'clang') # compiler variables section @@ -88,7 +89,7 @@ for comp in environ['COMPILER_OVERRIDE'].upper().split(','): compilers.extend(f'{comp}+{std}' for std in STANDARDS) else: - if not (IN_TERMUX and GCC_BINARY == 'g++') and which(GCC_BINARY): # Termux maps gcc->clang + if not (IN_TERMUX and GCC_BINARY == 'gcc') and which(GCC_BINARY): # Termux maps gcc->clang compilers.extend(f'GCC+{std}' for std in STANDARDS) if which('clang'): if b'AOCC' in check_output(['clang', '--version']): diff --git a/docs/cplusplus/p0002.rst b/docs/cplusplus/p0002.rst new file mode 100644 index 00000000..9f0c7d63 --- /dev/null +++ b/docs/cplusplus/p0002.rst @@ -0,0 +1,8 @@ +C++ Implementation of Problem 2 +=============================== + +View source code `here on GitHub! `_ + +.. literalinclude:: ../../cplusplus/p0002.cpp + :language: C++ + :linenos: diff --git a/docs/index.rst b/docs/index.rst index ee1f96e5..9052327d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -102,7 +102,7 @@ This project is divided into several Makefiles, connected by a root Makefile whi +-----------+------+------+------+------+------+------+ |:prob:`1` | |d| | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+------+ -|:prob:`2` | |d| | | |d| | |d| | |d| | |d| | +|:prob:`2` | |d| | |d| | |d| | |d| | |d| | |d| | +-----------+------+------+------+------+------+------+ |:prob:`3` | |d| | | | | |d| | |d| | +-----------+------+------+------+------+------+------+