ADDED tests/natools-s_expressions-enumeration_io-tests.adb Index: tests/natools-s_expressions-enumeration_io-tests.adb ================================================================== --- tests/natools-s_expressions-enumeration_io-tests.adb +++ tests/natools-s_expressions-enumeration_io-tests.adb @@ -0,0 +1,67 @@ +------------------------------------------------------------------------------ +-- Copyright (c) 2015, Natacha Porté -- +-- -- +-- Permission to use, copy, modify, and distribute this software for any -- +-- purpose with or without fee is hereby granted, provided that the above -- +-- copyright notice and this permission notice appear in all copies. -- +-- -- +-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- +-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- +-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- +-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- +-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- +-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- +-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- +------------------------------------------------------------------------------ + +with Ada.Streams.Stream_IO; +with Natools.S_Expressions.Test_Tools; + +package body Natools.S_Expressions.Enumeration_IO.Tests is + + package Stream_IO renames Ada.Streams.Stream_IO; + + package Test_IO is new Typed_IO (Stream_IO.File_Mode); + + + ------------------------- + -- Complete Test Suite -- + ------------------------- + + procedure All_Tests (Report : in out NT.Reporter'Class) is + begin + Basic_Usage (Report); + end All_Tests; + + + + ---------------------- + -- Individual Tests -- + ---------------------- + + procedure Basic_Usage (Report : in out NT.Reporter'Class) is + Test : NT.Test := Report.Item ("Basic usage with Stream_IO.File_Mode"); + use type Stream_IO.File_Mode; + begin + Test_Tools.Test_Atom + (Test, + To_Atom ("append-file"), + Test_IO.Image (Stream_IO.Append_File)); + + declare + Expected : constant Stream_IO.File_Mode := Stream_IO.Out_File; + Found : constant Stream_IO.File_Mode + := Test_IO.Value (To_Atom ("out-file")); + begin + if Expected /= Found then + Test.Fail ("Test_IO.Value returned " + & Stream_IO.File_Mode'Image (Found) + & ", expected " + & Stream_IO.File_Mode'Image (Expected)); + end if; + end; + exception + when Error : others => Test.Report_Exception (Error); + end Basic_Usage; + +end Natools.S_Expressions.Enumeration_IO.Tests; ADDED tests/natools-s_expressions-enumeration_io-tests.ads Index: tests/natools-s_expressions-enumeration_io-tests.ads ================================================================== --- tests/natools-s_expressions-enumeration_io-tests.ads +++ tests/natools-s_expressions-enumeration_io-tests.ads @@ -0,0 +1,28 @@ +------------------------------------------------------------------------------ +-- Copyright (c) 2015, Natacha Porté -- +-- -- +-- Permission to use, copy, modify, and distribute this software for any -- +-- purpose with or without fee is hereby granted, provided that the above -- +-- copyright notice and this permission notice appear in all copies. -- +-- -- +-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- +-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- +-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- +-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- +-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- +-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- +-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- +------------------------------------------------------------------------------ + +with Natools.Tests; + +package Natools.S_Expressions.Enumeration_IO.Tests is + pragma Preelaborate; + + package NT renames Natools.Tests; + + procedure All_Tests (Report : in out NT.Reporter'Class); + + procedure Basic_Usage (Report : in out NT.Reporter'Class); + +end Natools.S_Expressions.Enumeration_IO.Tests; Index: tests/test_all.adb ================================================================== --- tests/test_all.adb +++ tests/test_all.adb @@ -30,10 +30,11 @@ with Natools.S_Expressions.Atom_Buffers.Tests; with Natools.S_Expressions.Cache_Tests; with Natools.S_Expressions.Conditionals.Tests; with Natools.S_Expressions.Dynamic_Interpreter_Tests; with Natools.S_Expressions.Encodings.Tests; +with Natools.S_Expressions.Enumeration_IO.Tests; with Natools.S_Expressions.File_RW_Tests; with Natools.S_Expressions.Interpreter_Tests; with Natools.S_Expressions.Lockable.Tests; with Natools.S_Expressions.Parsers.Tests; with Natools.S_Expressions.Printers.Tests; @@ -123,10 +124,14 @@ Report.End_Section; Report.Section ("S_Expressions.Encodings"); Natools.S_Expressions.Encodings.Tests.All_Tests (Report); Report.End_Section; + + Report.Section ("S_Expressions.Enumeration_IO"); + Natools.S_Expressions.Enumeration_IO.Tests.All_Tests (Report); + Report.End_Section; Report.Section ("S_Expressions.File_Readers and File_Writers"); Natools.S_Expressions.File_RW_Tests.All_Tests (Report); Report.End_Section;