with Interfaces, Jwa;

use Interfaces, Jwa;

with Ada.Text_IO;
use Ada.Text_IO;

procedure Test_Jwa is


   procedure Boolean_8_32_Test is

      Some_Var : Boolean_32 := +5;


      Some_False : Boolean_32 := +0;
      Some_True : Boolean_32 := +1;
      Some_Also_True : Boolean_32 := +(-2);

      Byte_False : Boolean_8 := +0;
      Byte_True : Boolean_8 := +1;
      Byte_Also_True : Boolean_8 := +(-2);

      procedure Debug_Check (Prefix : String; Value : Boolean_32) is
      begin
         Put_Line (Prefix & " " & Integer_32'Image (+Value) & " " &
           Boolean'Image(+Value));
      end Debug_Check;

      procedure Debug_Check (Prefix : String; Value : Boolean_8) is
      begin
         Put_Line (Prefix & " " & Integer_8'Image (+Value) & " " &
           Boolean'Image(+Value));
      end Debug_Check;

      procedure Debug_Check (Prefix : String; Value : Boolean) is
      begin
         Put_Line (Prefix & " " & Boolean'Image (Value));
      end Debug_Check;

   begin
      Put_Line("Just testing...");
      Debug_Check ("Some_Var is", Some_Var);
      Debug_Check ("Some_False is", Some_False);
      Debug_Check ("Some_True is", Some_True);
      Debug_Check ("Some_Also_True is", Some_Also_True);
      New_Line;
      Debug_Check ("+0    =   +0    ->", Some_False = Some_False);
      Debug_Check ("+0    =   +1    ->", Some_False = Some_True);
      Debug_Check ("+0    =   +(-2) ->", Some_False = Some_Also_True);
      Debug_Check ("+1    =   +1    ->", Some_True = Some_True);
      Debug_Check ("+1    =   +(-2) ->", Some_True = Some_Also_True);
      Debug_Check ("+(-2) =   +(-2) ->", Some_Also_True = Some_Also_True);
      New_Line;
      Debug_Check ("+0    and +0    ->", Some_False and Some_False);
      Debug_Check ("+0    and +1    ->", Some_False and Some_True);
      Debug_Check ("+0    and +(-2) ->", Some_False and Some_Also_True);
      Debug_Check ("+1    and +1    ->", Some_True and Some_True);
      Debug_Check ("+1    and +(-2) ->", Some_True and Some_Also_True);
      Debug_Check ("+(-2) and +(-2) ->", Some_Also_True and Some_Also_True);
      New_Line;
      Debug_Check ("+0    or  +0    ->", Some_False or Some_False);
      Debug_Check ("+0    or  +1    ->", Some_False or Some_True);
      Debug_Check ("+0    or  +(-2) ->", Some_False or Some_Also_True);
      Debug_Check ("+1    or  +1    ->", Some_True or Some_True);
      Debug_Check ("+1    or  +(-2) ->", Some_True or Some_Also_True);
      Debug_Check ("+(-2) or  +(-2) ->", Some_Also_True or Some_Also_True);
      New_Line;
      Debug_Check ("+0    xor +0    ->", Some_False xor Some_False);
      Debug_Check ("+0    xor +1    ->", Some_False xor Some_True);
      Debug_Check ("+0    xor +(-2) ->", Some_False xor Some_Also_True);
      Debug_Check ("+1    xor +1    ->", Some_True xor Some_True);
      Debug_Check ("+1    xor +(-2) ->", Some_True xor Some_Also_True);
      Debug_Check ("+(-2) xor +(-2) ->", Some_Also_True xor Some_Also_True);
      New_Line;
      Debug_Check ("      not +0    ->", not Some_False);
      Debug_Check ("      not +1    ->", not Some_True);
      Debug_Check ("      not +(-2) ->", not Some_Also_True);
      New_Line;
      Debug_Check ("True_32  is", True_32);
      Debug_Check ("False_32 is", False_32);
   --   Debug_Check ("Should be impossible", True_32 + True_32);
      Put_Line ("Now 8-bit...");
      New_Line;
      Debug_Check ("+0    =   +0    ->", Byte_False = Byte_False);
      Debug_Check ("+0    =   +1    ->", Byte_False = Byte_True);
      Debug_Check ("+0    =   +(-2) ->", Byte_False = Byte_Also_True);
      Debug_Check ("+1    =   +1    ->", Byte_True = Byte_True);
      Debug_Check ("+1    =   +(-2) ->", Byte_True = Byte_Also_True);
      Debug_Check ("+(-2) =   +(-2) ->", Byte_Also_True = Byte_Also_True);
      New_Line;
      Debug_Check ("+0    and +0    ->", Byte_False and Byte_False);
      Debug_Check ("+0    and +1    ->", Byte_False and Byte_True);
      Debug_Check ("+0    and +(-2) ->", Byte_False and Byte_Also_True);
      Debug_Check ("+1    and +1    ->", Byte_True and Byte_True);
      Debug_Check ("+1    and +(-2) ->", Byte_True and Byte_Also_True);
      Debug_Check ("+(-2) and +(-2) ->", Byte_Also_True and Byte_Also_True);
      New_Line;
      Debug_Check ("+0    or  +0    ->", Byte_False or Byte_False);
      Debug_Check ("+0    or  +1    ->", Byte_False or Byte_True);
      Debug_Check ("+0    or  +(-2) ->", Byte_False or Byte_Also_True);
      Debug_Check ("+1    or  +1    ->", Byte_True or Byte_True);
      Debug_Check ("+1    or  +(-2) ->", Byte_True or Byte_Also_True);
      Debug_Check ("+(-2) or  +(-2) ->", Byte_Also_True or Byte_Also_True);
      New_Line;
      Debug_Check ("+0    xor +0    ->", Byte_False xor Byte_False);
      Debug_Check ("+0    xor +1    ->", Byte_False xor Byte_True);
      Debug_Check ("+0    xor +(-2) ->", Byte_False xor Byte_Also_True);
      Debug_Check ("+1    xor +1    ->", Byte_True xor Byte_True);
      Debug_Check ("+1    xor +(-2) ->", Byte_True xor Byte_Also_True);
      Debug_Check ("+(-2) xor +(-2) ->", Byte_Also_True xor Byte_Also_True);
      New_Line;
      Debug_Check ("      not +0    ->", not Byte_False);
      Debug_Check ("      not +1    ->", not Byte_True);
      Debug_Check ("      not +(-2) ->", not Byte_Also_True);
      New_Line;
      Debug_Check ("True_8  is", True_8);
      Debug_Check ("False_8 is", False_8);
      New_Line;

   end Boolean_8_32_Test;

   procedure Strings_Test is

   begin
      Test_Func (+"String");
   end Strings_Test;

begin
   Boolean_8_32_Test;

end Test_Jwa;                                
