Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Created June 2, 2014 05:57
Show Gist options
  • Select an option

  • Save StoneCypher/59bfeb9bad98850b5242 to your computer and use it in GitHub Desktop.

Select an option

Save StoneCypher/59bfeb9bad98850b5242 to your computer and use it in GitHub Desktop.
-module(vlp_tests).
-compile(export_all).
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").
prop_square_never_negative() ->
?FORALL( N,
proper_types:number(),
vlp:square(N) >= 0
).
square_test_() ->
{ "Square test", [
{ "0", ?_assert( 0 == vlp:square( 0) ) },
{ "1", ?_assert( 1 == vlp:square( 1) ) },
{ "-1", ?_assert( 1 == vlp:square( -1) ) },
{ " 2", ?_assert( 4 == vlp:square( 2) ) },
{ "-2", ?_assert( 4 == vlp:square( -2) ) },
{ "1.25", ?_assert( 1.5625 == vlp:square( 1.25) ) },
{ "-1.25", ?_assert( 1.5625 == vlp:square(-1.25) ) }
] }.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment