------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 1995 by International Computer Science Institute            --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

class R_TEST is -- thread safe version of TEST
               -- in the sense that more than one thread can call test(),
	       -- but neither finish nor test_class are thread safe.
	       -- It is also not possible to instantiate more than
	       -- one object of this class.
   include TEST test->t_test,
   	unchecked_test->t_unchecked_test,
   	class_name->t_class_name;
   -- actually we should use a MUTEX and the standard lock stmt. But MUTEX
   -- is already a very highlevel construct, so we use a low level
   -- lock here and are therefor able to test MUTEX too with this classs.
   shared lck:LL_LOCK;

   test(doc_ds,does_ds,should_ds:$STR) is
      -- Perform the test with the description `doc', return value `does',
      -- and desired return value `should'. Keep track of failures.
      lck.lck;
         t_test(doc_ds,does_ds,should_ds);
      lck.unlck;
   end;
   
   unchecked_test(doc_ds,does_ds,should_ds:$STR) is
      -- Perform the test with the description `doc', return value `does',
      -- and desired return value `should'. Don't keep track of failures.
      lck.lck;
         t_unchecked_test(doc_ds,does_ds,should_ds);
      lck.unlck;
   end;

   class_name(nm:STR) is
      if void(lck) then lck:=#LL_LOCK; end;
      t_class_name(nm);
   end;
end;
-------------------------------------------------------------------
