Simple application to practice golang with implementing some logic gates
- Not gate
Truth table
| A | Not(A) |
|---|---|
| 1 | 0 |
| 0 | 1 |
- And gate
Truth table
| A | B | And(A,B) |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
- Or gate
Truth table
| A | B | Or(A,B) |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 1 |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
- Nand gate
Truth table
| A | B | Nand(A,B) |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 1 |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
- Nor gate
Truth table
| A | B | Nor(A,B) |
|---|---|---|
| 1 | 1 | 0 |
| 1 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
- Half adder
Truth table
| A | B | C | S |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
go test -tags="nativ" ./basic/ -v -cover
go test -tags="nand" ./basic/ -v -cover
go test -tags="nor" ./basic/ -v -coverUnder ./basic/ directory
go test -tags="nativ" -bench=.
go test -tags="nand" -bench=.
go test -tags="nor" -bench=.To build the cli app, you have to run the following commands:
dep ensure
go build -tags nativ -o gate-cli cmd/cli/cli.goThe first one is necessary for the package dependency related stuff. The next one builds the cli application. Then you can run the app with the following command:
./gate-cli