May 2019
Intermediate to advanced
698 pages
17h 21m
English
Armed with all of this knowledge, let's start things off with our logic gate simulation crate. We'll create a new project by running cargo new logic_gates --lib. Starting with primitive gates implemented as functions such as and, xor, and so on, we will write unit tests for these gates. Following that, we'll write integration tests by implementing a half adder that uses our primitive gates. During this process, we'll also get to write documentation for our crate.
First off, we'll start with some unit tests. Here's the initial crate code in its entirety:
//! This is a logic gates simulation crate built to demonstrate writing unit tests and integration tests// logic_gates/src/lib.rspub fn ...
Read now
Unlock full access