|
1 | | -use lib '.'; #Tells Perl6 to Search in the Current Directory |
2 | | -use tools; #The Module we created in tools.pm6 (unit module) |
3 | | -use Test; #Test Module to perform tests |
| 1 | +use lib '.'; |
| 2 | +use sign-in; |
| 3 | +use Test; |
4 | 4 |
|
5 | | -#Declare the amount of tests that you plan one running. If you don't do this the test fails. |
6 | | -plan 1; |
| 5 | +#Plan |
| 6 | +plan 4; |
7 | 7 |
|
8 | | -#Avg is the function we called in tools.pm6 |
9 | | -my $result = avg(2,4); |
| 8 | +########################################### |
| 9 | +#####Tests for Verification of Account##### |
| 10 | +########################################### |
10 | 11 |
|
11 | | -#Checks if the result is equal to the average of 2 and 4 and the test passes since result equals 3 |
12 | | -ok($result eq 3, 'CORRECT'); |
| 12 | +#Working Test |
| 13 | +my $account-made = account-made("Hello", "test@test.com", "secret"); |
| 14 | +ok($account-made = 1, 'Account Made'); |
| 15 | + |
| 16 | +#Missing Value | Error Message is Long and Dumb |
| 17 | +my $account-missing = account-made("Hello", Nil, "secret"); |
| 18 | +ok($account-missing = "DBDish::SQLite: Error: UNIQUE constraint failed: accounts.username (19) |
| 19 | + in method execute at /usr/local/Cellar/rakudo-star/2019.03/share/perl6/site/sources/DE559529B32B6D348188B437156092A03C0433A1 (DBDish::SQLite::StatementHandle) line 45 |
| 20 | + in sub account-made at /Users/1013042/Repos/ingredient.guru/CRO/tests/sign-in.pm6 (sign-in) line 37 |
| 21 | + in block <unit> at prove.t6 line 18", 'Value Missing'); |
| 22 | + |
| 23 | +#Correct Info | Email Correct |
| 24 | +my $account-email = email-valid("test@test.com"); |
| 25 | +ok($account-email = True, 'Email Correct'); |
| 26 | + |
| 27 | +#Incorrect Info | Email Incorrect |
| 28 | +#my $account-email-inc = email-valid("d"); |
| 29 | +#ok($account-email-inc = False, 'Email Incorrect'); |
0 commit comments