-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update READMEs, add to filter, split off python-lint
- Loading branch information
1 parent
a157716
commit 686ba3f
Showing
16 changed files
with
255 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
paths-ignore: | ||
- 'docs/**' | ||
- 'README.rst' | ||
- '**/README.rst' | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
paths-ignore: | ||
- 'docs/**' | ||
- 'README.rst' | ||
- '**/README.rst' | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
paths-ignore: | ||
- 'docs/**' | ||
- 'README.rst' | ||
- '**/README.rst' | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
paths-ignore: | ||
- 'docs/**' | ||
- 'README.rst' | ||
- '**/README.rst' | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ``<stdlib.h>`` | ||
or ``<math.h>`` 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>`__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.