-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from PSU-Capstone-Team24/TC_014-015
Tc 014 015
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
-- Temp disabling | ||
pragma Style_Checks (Off); | ||
|
||
with AUnit.Assertions; | ||
with AUnit.Test_Caller; | ||
with GNAT.OS_Lib; | ||
with Bindings.Rlite.API; | ||
with Exceptions; | ||
|
||
package body Test_RINA_Unregister is | ||
use AUnit.Assertions; | ||
use GNAT.OS_Lib; | ||
use Bindings.Rlite.API; | ||
|
||
Application_Name : constant String := "TestApplicationName"; | ||
DIF_Name : constant String := "test.DIF"; | ||
RINA_Dev_FD : constant File_Descriptor := RINA_Open; | ||
|
||
package Caller is new AUnit.Test_Caller (Test); | ||
|
||
Test_Suite : aliased AUnit.Test_Suites.Test_Suite; | ||
|
||
function Suite return AUnit.Test_Suites.Access_Test_Suite is | ||
Name_014 : constant String := "TC-014"; | ||
Name_015 : constant String := "TC-015"; | ||
begin | ||
Test_Suite.Add_Test (Caller.Create | ||
(Name_014 & " Verify rina_unregister throws exception when DIF name empty", Test_Unregister_DIF_Name_Empty'Access)); | ||
Test_Suite.Add_Test (Caller.Create | ||
(Name_015 & " Verify rina_unregister throws exception when DIF name isn't already registered", Test_Unregister_DIF_Name_Not_Registered'Access)); | ||
|
||
return Test_Suite'Access; | ||
end Suite; | ||
|
||
--Test Case 014 | ||
procedure Test_Unregister_DIF_Name_Empty (Object : in out Test) is | ||
DIF_Name : constant String := ""; | ||
App_Name : constant String := "Test App"; | ||
Unregister_Success : File_Descriptor := Invalid_FD; | ||
Caused_Error : Boolean := False; | ||
begin | ||
|
||
Unregister_Success := RINA_Unregister (RINA_Dev_FD, DIF_Name, App_Name, 0); | ||
exception | ||
when Exceptions.Bounded_Length_Expcetion => | ||
Caused_Error := True; | ||
|
||
Assert (Caused_Error and Unregister_Success = Invalid_FD, "DIF_Name is empty"); | ||
end Test_Unregister_DIF_Name_Empty; | ||
|
||
procedure Test_Unregister_DIF_Name_Not_Registered (Object : in out Test) is | ||
DIF_Name : constant String := "Unique_DIF_Name"; | ||
App_Name : constant String := "Test App"; | ||
Unregister_Success : File_Descriptor := Invalid_FD; | ||
Caused_Error : Boolean := False; | ||
begin | ||
Unregister_Success := RINA_Unregister (RINA_Dev_FD, DIF_Name, App_Name, 0); | ||
exception | ||
when Exceptions.DIF_Registration_Failure => | ||
Caused_Error := True; | ||
|
||
Assert (Caused_Error and Unregister_Success = Invalid_FD, "DIF_Name is not already registered"); | ||
end Test_Unregister_DIF_Name_Not_Registered; | ||
|
||
end Test_RINA_Unregister; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- Temp disabling | ||
pragma Style_Checks (Off); | ||
|
||
with AUnit.Test_Suites; | ||
with AUnit.Test_Fixtures; | ||
|
||
package Test_RINA_Unregister is | ||
function Suite return AUnit.Test_Suites.Access_Test_Suite; | ||
|
||
private | ||
type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; | ||
|
||
procedure Test_Unregister_DIF_Name_Empty (Object : in out Test); | ||
procedure Test_Unregister_DIF_Name_Not_Registered (Object : in out Test); | ||
|
||
end Test_RINA_Unregister; |