Created
May 10, 2015 18:35
-
-
Save sleepyfox/3a0f1d6687a52695613f to your computer and use it in GitHub Desktop.
TDD in Erlang with EUnit
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
-module(tdd_starter). | |
-export([sum/2, product/2]). | |
-include_lib("eunit/include/eunit.hrl"). | |
sum(A, B) -> A + B. | |
product(A, B) -> A * B. | |
sum_test() -> | |
?assertEqual(0, sum(0, 0)), | |
?assertEqual(2, sum(1, 1)). | |
product_test() -> | |
?assertEqual(0, product(1, 0)), | |
?assertEqual(3, product(3, 1)), | |
?assertEqual(6, product(3, 2)). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment