⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cxa4032.a

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 A
📖 第 1 页 / 共 2 页
字号:
      -- Procedure Delete      TC_Unb_String := Unb.To_Unbounded_String("Test String");      -- From > Through  (No change to Source)      Unb.Delete(Source  => TC_Unb_String,                  From    => Unb.Length(TC_Unb_String),                 Through => Unb.Length(TC_Unb_String)-1);      if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then         Report.Failed("Incorrect results from Delete - 1");      end if;      Unb.Delete(TC_Unb_String, 1, 0);      if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then         Report.Failed("Incorrect results from Delete - 2");      end if;      -- From <= Through      Unb.Delete(TC_Unb_String, 1, 5);      if TC_Unb_String /= Unb.To_Unbounded_String("String") then         Report.Failed("Incorrect results from Delete - 3");      end if;      Unb.Delete(TC_Unb_String, 3, 3);      if TC_Unb_String /= Unb.To_Unbounded_String("Sting") then         Report.Failed("Incorrect results from Delete - 4");      end if;      -- Procedure Trim       TC_Unb_String := Unb.To_Unbounded_String("No Spaces");      Unb.Trim(Source => TC_Unb_String, Side => Ada.Strings.Both);      if TC_Unb_String /= Unb.To_Unbounded_String("No Spaces") then         Report.Failed("Incorrect results from Trim - 1");      end if;      TC_Unb_String := Unb.To_Unbounded_String("   Leading Spaces   ");      Unb.Trim(TC_Unb_String, Ada.Strings.Left);      if TC_Unb_String /= Unb.To_Unbounded_String("Leading Spaces   ") then         Report.Failed("Incorrect results from Trim - 2");      end if;      TC_Unb_String := Unb.To_Unbounded_String("   Ending Spaces   ");      Unb.Trim(TC_Unb_String, Ada.Strings.Right);      if TC_Unb_String /= Unb.To_Unbounded_String("   Ending Spaces") then         Report.Failed("Incorrect results from Trim - 3");      end if;      TC_Unb_String :=         Unb.To_Unbounded_String("    Spaces   on  both  ends     ");      Unb.Trim(TC_Unb_String, Ada.Strings.Both);      if TC_Unb_String /=          Unb.To_Unbounded_String("Spaces   on  both  ends")       then         Report.Failed("Incorrect results from Trim - 4");      end if;      -- Procedure Trim (with Character Set parameters)      TC_Unb_String := Unb.To_Unbounded_String("lowerCASEletters");      Unb.Trim(Source => TC_Unb_String,               Left   => Ada.Strings.Maps.Constants.Lower_Set,               Right  => Ada.Strings.Maps.Constants.Lower_Set);      if TC_Unb_String /= Unb.To_Unbounded_String("CASE") then         Report.Failed("Incorrect results from Trim with Sets - 1");      end if;      TC_Unb_String := Unb.To_Unbounded_String("lowerCASEletters");      Unb.Trim(TC_Unb_String,                Ada.Strings.Maps.Constants.Upper_Set,               Ada.Strings.Maps.Constants.Upper_Set);      if TC_Unb_String /= Unb.To_Unbounded_String("lowerCASEletters") then         Report.Failed("Incorrect results from Trim with Sets - 2");      end if;      TC_Unb_String := Unb.To_Unbounded_String("012abcdefghGFEDCBA789ab");      Unb.Trim(TC_Unb_String,               Ada.Strings.Maps.Constants.Hexadecimal_Digit_Set,               Ada.Strings.Maps.Constants.Hexadecimal_Digit_Set);      if TC_Unb_String /= Unb.To_Unbounded_String("ghG") then         Report.Failed("Incorrect results from Trim with Sets - 3");      end if;      -- Procedure Head      -- Count <= Source'Length      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Head(Source => TC_Unb_String,               Count  => 0,               Pad    => '*');      if TC_Unb_String /= Unb.Null_Unbounded_String then         Report.Failed("Incorrect results from Head - 1");      end if;      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Head(Source => TC_Unb_String,               Count  => 4,               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("Test") then         Report.Failed("Incorrect results from Head - 2");      end if;      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Head(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String),               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then         Report.Failed("Incorrect results from Head - 3");      end if;      -- Count > Source'Length      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Head(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String) + 4,               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("Test String****") then         Report.Failed("Incorrect results from Head - 4");      end if;      TC_Unb_String := Unb.Null_Unbounded_String;      Unb.Head(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String) + 3,               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("***") then         Report.Failed("Incorrect results from Head - 5");      end if;      -- Procedure Tail      -- Count <= Source'Length      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Tail(Source => TC_Unb_String,               Count  => 0,               Pad    => '*');      if TC_Unb_String /= Unb.Null_Unbounded_String then         Report.Failed("Incorrect results from Tail - 1");      end if;      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Tail(Source => TC_Unb_String,               Count  => 6,               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("String") then         Report.Failed("Incorrect results from Tail - 2");      end if;      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Tail(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String),               Pad    => '*');      if TC_Unb_String /= Unb.To_Unbounded_String("Test String") then         Report.Failed("Incorrect results from Tail - 3");      end if;      -- Count > Source'Length      TC_Unb_String := Unb.To_Unbounded_String("Test String");      Unb.Tail(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String) + 5,               Pad    => 'x');      if TC_Unb_String /= Unb.To_Unbounded_String("xxxxxTest String") then         Report.Failed("Incorrect results from Tail - 4");      end if;      TC_Unb_String := Unb.Null_Unbounded_String;      Unb.Tail(Source => TC_Unb_String,               Count  => Unb.Length(TC_Unb_String) + 3,               Pad    => 'X');      if TC_Unb_String /= Unb.To_Unbounded_String("XXX") then         Report.Failed("Incorrect results from Tail - 5");      end if;   exception      when others => Report.Failed ("Exception raised in Test_Block");   end Test_Block;   Report.Result;end CXA4032;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -