Skip to content

Latest commit

 

History

History
88 lines (80 loc) · 3.22 KB

README.md

File metadata and controls

88 lines (80 loc) · 3.22 KB

Euler-Rust

My Project Euler track in Rust. Every solution is commented, and some problems feature multiple solutions.

Compiling and Running

Default cargo run

This project uses Cargo. With rust installed on your machine, you can execute my code with:

$ cargo run

The main program then asks for a Problem number to run, which you can enter in the command line:

$ cargo run
    Compiling ...
     Finished ...
      Running ...
Problem number:
1

Environment Argument

Alternatively, you can directly pass the problem number as an environment argument:

$ cargo run 1
    Compiling ...
     Finished ...
      Running ...
Problem 1 solution: ...

Unit Tests

Finally, I have configured unit tests for each problem. You can run them with:

$ cargo test

or to run a specific test:

$ cargo test test_problem1

Some problems have multiple solutions, and the unit tests are configured to run all of them.

$ cargo test test_problem1_v2

Some solutions, such as the one for Problem 23, take a few more seconds to run than the others. Corresponding tests are ignored by default, but you can run them with:

$ cargo test -- --ignored

or to run all tests, ignored or not:

$ cargo test -- --include-ignored

Problems solved

License

This work is licensed under the CC-BY-NC-SA 4.0 license. Original content is the property of the Project Euler website and also licensed under CC-BY-NC-SA 4.0.