/* $XConsortium: archivest.pi,v 5.2 94/04/17 20:47:08 rws Exp $ */ /***************************************************************** Copyright (c) 1989, 1990, 1991,1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989, 1990, 1991,1990 by Sun Microsystems, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Sun Microsystems, and the X Consortium, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, 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. ******************************************************************/ ## archivest.pi - ## Test archive operating state ## Test the following sequences: ## open archfile1, close archfile1, open archfile1 open archfile2, ## close archfile2, close archfile1 ## Verify archive state changes ## Verify the list of opened archive files source macro.pi source scmacro.pi tbegintest("archivest","archive operating state"); # SETUP: open phigs, remove existing arhcive files if any i_open_phigs(NULL,PDEF_MEM_SIZE); unlink("archfile1"); unlink("archfile2"); # TEST begin: # verify that archive state is ARCL, list of archive files = () im_confirm_archivestate(PST_ARCL, "state = %d, expected PST_ARCL before opening archfile1\n"); im_confirm_archfiles(0,NULL,NULL,NULL,NULL, "failed: list of archive file != empty before opening archfile1\n"); # open archfile1 popen_ar_file(1,"archfile1"); # verify that archive state is AROP, # list of archive files = ([1,archfile1]) im_confirm_archivestate(PST_AROP, "state = %d, expected PST_AROP after opening archfile1\n"); im_confirm_archfiles(1,1,"archfile1",NULL,NULL, "failed: list of archive file != (1) after opening archfile1\n"); # close archfile1 pclose_ar_file(1); # verify that archive state is ARCL, list of archive files = () im_confirm_archivestate(PST_ARCL, "state = %d, expected PST_ARCL after closing archfile1\n"); im_confirm_archfiles(0,NULL,NULL,NULL,NULL, "failed: list of archive file != empty after closing archfile1\n"); # open archfile1 popen_ar_file(1,"archfile1"); # verify that archive state is AROP, # list of archive files = ([1,archfile1]) im_confirm_archivestate(PST_AROP, "state = %d, expected PST_AROP after re-opening archfile1\n"); im_confirm_archfiles(1,1,"archfile1",NULL,NULL, "failed: list of archive file != (1) after re-opening archfile1\n"); # open archfile2 popen_ar_file(2,"archfile2"); # verify that archive state is AROP, # list of archive files = ([1,archfile1], [2,archfile2]) im_confirm_archivestate(PST_AROP, "state = %d, expected PST_AROP after opening archfile2\n"); im_confirm_archfiles(2,1,"archfile1",2,"archfile2", "failed: list of archive file != (1,2) after opening archfile2\n"); # close archfile2 pclose_ar_file(2); # verify that archive state is AROP, # list of archive files = ([1,archfile1]) im_confirm_archivestate(PST_AROP, "state = %d, expected PST_AROP after closing archfile2\n"); im_confirm_archfiles(1,1,"archfile1",NULL,NULL, "failed: list of archive file != (1) after closing archfile2\n"); # close archfile1 pclose_ar_file(1); # verify that archive state is ARCL, list of archive files = () im_confirm_archivestate(PST_ARCL, "state = %d, expected PST_ARCL after re-closing archfile1\n"); im_confirm_archfiles(0,NULL,NULL,NULL,NULL, "failed: list of archive file != empty after re-closing archfile1\n"); # CLEANUP: remove created archive files unlink("archfile1"); unlink("archfile2"); tendtest()