fmultimap_test.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- test_fmultimap.sa: 
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: fmultimap_test.sa,v 1.3 1996/04/09 10:04:59 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_FMULTIMAP

class TEST_FMULTIMAP is include TEST; main is class_name("FMULTIMAP"); a: FMULTIMAP{STR,INT} := #; loop a := a.insert("foo",5.times!) end; loop a := a.insert("bar",3.times!); end; test("insert,n_targets",a.n_targets("foo"),5); test("n_inds",a.n_inds,2); test("n_inds",a.n_targets,8); test("insert,n_targets",a.n_targets("bar"),3); test("insert,n_targets",a.n_targets("baz"),0); test("has_pair",a.has_pair("foo",1),true); test("has_pair",a.has_pair("foo",7),false); a := a.delete("foo",1); test("delete", a.has_pair("foo",1),false); l: FLIST{INT} := #; loop l := l.push(a.target!("foo")) end; test("get!",l.has(0),true); test("get!",l.has(1),false); test("get!",l.has(2),true); test("get!",l.has(3),true); test("get!",l.has(4),true); loop a := a.insert("gark",100.times!) end; test("n_targets",a.n_targets("gark"),100); test("n_targets",a.n_targets("foo"),4); loop a := a.delete("gark",100.times!) end; test("n_targets",a.n_targets("gark"),0); test("n_targets",a.n_targets,7); b: FMULTIMAP{STR,INT} := #; b := b.insert("brak",0); b := b.insert("brak",1); b := b.insert("brak",2); finish; end; end;