From 8dbb1a8be40d8074bdafdaf366849847b3ae0c38 Mon Sep 17 00:00:00 2001 From: Keian Kaserman Date: Mon, 5 Feb 2024 23:35:08 -0500 Subject: [PATCH] Add TC-018 --- eRINA_Tests/src/test_rina_unregister.adb | 14 ++++++++++++++ eRINA_Tests/src/test_rina_unregister.ads | 1 + 2 files changed, 15 insertions(+) diff --git a/eRINA_Tests/src/test_rina_unregister.adb b/eRINA_Tests/src/test_rina_unregister.adb index 9cb4019..7704135 100644 --- a/eRINA_Tests/src/test_rina_unregister.adb +++ b/eRINA_Tests/src/test_rina_unregister.adb @@ -27,6 +27,7 @@ package body Test_RINA_Unregister is Name_015 : constant String := "TC-015"; Name_016 : constant String := "TC-016"; Name_017 : constant String := "TC-017"; + Name_018 : constant String := "TC-018"; begin Test_Suite.Add_Test (Caller.Create (Name_012 & " Verify that rina_unregister successfully unregisters an application name from a DIF", Test_Unregister_AppName_to_DIF'Access)); @@ -40,6 +41,9 @@ package body Test_RINA_Unregister is (Name_016 & " Verify rina_unregister throws exception when application name is too long", Test_Unregister_App_Name_Too_Long'Access)); Test_Suite.Add_Test (Caller.Create (Name_017 & " Verify rina_unregister throws exception when application name is empty", Test_Unregister_App_Name_Empty'Access)); + Test_Suite.Add_Test (Caller.Create + (Name_018 & " Verify rina_unregister returns Invalid_FD when passed an invalid file descriptor for the control device", Test_Unregister_Invalid_File_Descriptor'Access)); + return Test_Suite'Access; end Suite; @@ -124,4 +128,14 @@ package body Test_RINA_Unregister is Assert (Caused_Error and Unregister_Success = Invalid_FD, "App name is empty"); end Test_Unregister_App_Name_Empty; + -- TC 018 + procedure Test_Unregister_Invalid_File_Descriptor (Object : in out Test) is + Invalid_FileD : File_Descriptor := Invalid_FD; + Unregister_Success : File_Descriptor; + Caused_Error : Boolean := False; + begin + Unregister_Success := RINA_Register(Invalid_FileD, DIF_Name, "NewTestAppName", 0); + Assert (Caused_Error = False and Unregister_Success = Invalid_FD, "Invalid file descriptor passed for control device"); + end Test_Unregister_Invalid_File_Descriptor; + end Test_RINA_Unregister; \ No newline at end of file diff --git a/eRINA_Tests/src/test_rina_unregister.ads b/eRINA_Tests/src/test_rina_unregister.ads index 3273ada..c7dc6ea 100644 --- a/eRINA_Tests/src/test_rina_unregister.ads +++ b/eRINA_Tests/src/test_rina_unregister.ads @@ -16,5 +16,6 @@ private procedure Test_Unregister_DIF_Name_Not_Registered (Object : in out Test); procedure Test_Unregister_App_Name_Too_Long (Object : in out Test); procedure Test_Unregister_App_Name_Empty (Object : in out Test); + procedure Test_Unregister_Invalid_File_Descriptor (Object : in out Test); end Test_RINA_Unregister;