-
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.
- Loading branch information
1 parent
d61d4e6
commit 3deb140
Showing
8 changed files
with
111 additions
and
2 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
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,10 @@ | ||
test: dependencies | ||
dotnet test | ||
|
||
test_%: dependencies | ||
echo "WARNING: multithreaded tests not supported on javascript" | ||
$(MAKE) test | ||
|
||
dependencies: | ||
dotnet restore | ||
|
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,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. |
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,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<DockerfileContext>.</DockerfileContext> | ||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="xunit" Version="2.8.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.21" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.21"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.21"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
Empty file.
Empty file.