queue_test.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- test_queue.sa: queue tests
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: queue_test.sa,v 1.2 1996/04/09 10:05:24 borisv Exp $
--
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.


class TEST_QUEUE

class TEST_QUEUE is include TEST; main is class_name("QUEUE"); q: A_QUEUE{STR} := #A_QUEUE{STR}; test("is_empty",q.is_empty.str,true.str); q.enq("a"); test("is_empty",q.is_empty.str,false.str); test("top",q.top,"a"); test("remove 1",q.remove,"a"); q.enq("b"); q.enq("c"); q.enq("d"); q.enq("e"); q.enq("f"); test("size",q.size.str,5.str); test("remove 2",q.remove,"b"); test("remove 3",q.remove,"c"); test("remove 4",q.remove,"d"); test("remove 5",q.remove,"e"); test("is_empty",q.is_empty.str,false.str); test("remove 6",q.remove,"f"); test("size",q.size.str,0.str); test("is_empty",q.is_empty.str,true.str); q.enq("a"); q.enq("b"); q.enq("c"); q.enq("d"); q.enq("e"); q.enq("f"); q.enq("1a"); q.enq("1b"); q.enq("1c"); q.enq("1d"); q.enq("1e"); q.enq("1f"); test("size",q.size.str,12.str); test("remove",q.remove,"a"); test("remove",q.remove,"b"); test("remove",q.remove,"c"); m ::= #QUEUE{INT}; test("is_empty",m.is_empty,true); finish; end; end;