/* $XConsortium: wdt3.c,v 5.3 94/04/17 20:47:13 hersh Exp $ */ /***************************************************************** Copyright (c) 1989,1990, 1991 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 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. ******************************************************************/ /* ## wdt3.c : ## compares the implementation dependent data in workstation description table ## against the values returned from inquiries. ## Testing miscellaneous workstation dependent inquires: ## # supplying command argument: ## 1: to test pinq_ws_conn_type ## 2: to test pinq_ws_cat, ## 3: to test pinq_ws_class ## 4: to test pinq_ws_st_table ## 5: to test pinqdisplayspacesize, ## 6: to test pinqdisplayspacesize3 ## 7: to test pinq_dyns_ws_attrs ## 8: to test pinq_dyns_structs ## 9: to test pinq_num_disp_pris ## 10:to test pinq_def_disp_upd_st ## 11:to test pinq_gdp, pinq_list_avail_gdp ## 12:to test pinq_gdp3, pinq_list_avail_gdp3 ## 13:to test pinq_list_avail_gse */ #include "phigs/phigs.h" #include "imath.h" #include "wdt.h" #include "logmsg.h" /* constants */ #define BUFSIZE 1024 #define BOGUSERR -999 static void verify_ws_conn_type(); static void verify_ws_cat(); static void verify_ws_class(); static void verify_ws_st_table(); static void verify_disp_sp_size(); static void verify_disp_sp_size3(); static void verify_dyn_ws_attr(); static void verify_dyn_struct(); static void verify_num_disp_pri(); static void verify_def_disp_upd_st(); static void verify_gdp(); static void verify_gdp3(); static void verify_avail_gse(); /* commonly used variables */ Pint err; Pint status; Pint total; Pint wstype; /* specific workstation type */ #define ERROR(string) \ if (err) { \ tfprintf("ERROR: %d in %s\n", err,string);\ return;\ } main(argc,argv) int argc; char **argv; { Pconnid connid; char testdesc[256]; int i, test; char charbuf[BUFSIZE]; sprintf(testdesc,"\"%s\" ws miscellaneous inquires",WSTYPE); tbegintest("wdt3",testdesc); i_open_phigs((char *)0, PDEF_MEM_SIZE); /* ws type dependent procedure to open a ws */ OPEN_WS1(); err = BOGUSERR; connid = charbuf; pinq_ws_conn_type(1,BUFSIZE,&err,&connid,&wstype); ERROR("pinq_ws_conn_type"); if (argc < 2) { verify_ws_conn_type(); verify_ws_cat(); verify_ws_class(); verify_ws_st_table(); verify_disp_sp_size(); verify_disp_sp_size3(); verify_dyn_ws_attr(); verify_dyn_struct(); verify_num_disp_pri(); verify_def_disp_upd_st(); verify_gdp(); verify_gdp3(); verify_avail_gse(); }else for (i = 1; i < argc; ++i) { test = atoi(argv[i]); switch(test) { case 1: tvprintf(2,"testing pinq_ws_conn_type\n"); verify_ws_conn_type(); break; case 2: tvprintf(2,"testing pinq_ws_cat\n"); verify_ws_cat(); break; case 3: tvprintf(2,"testing pinq_ws_class\n"); verify_ws_class(); break; case 4: tvprintf(2,"testing pinq_ws_st_table\n"); verify_ws_st_table(); break; case 5: tvprintf(2,"testing pinqdisplayspacesize,\n"); verify_disp_sp_size(); break; case 6: tvprintf(2,"testing pinqdisplayspacesize3\n"); verify_disp_sp_size3(); break; case 7: tvprintf(2,"testing pinq_dyns_ws_attrs\n"); verify_dyn_ws_attr(); break; case 8: tvprintf(2,"testing pinq_dyns_structs\n"); verify_dyn_struct(); break; case 9: tvprintf(2,"testing pinq_num_disp_pris\n"); verify_num_disp_pri(); break; case 10: tvprintf(2,"testing pinq_def_disp_upd_st\n"); verify_def_disp_upd_st(); break; case 11: tvprintf(2,"testing pinq_gdp, pinq_list_avail_gdp\n"); verify_gdp(); break; case 12: tvprintf(2,"testing pinq_gdp3, pinq_list_avail_gdp3\n"); verify_gdp3(); break; case 13: tvprintf(2,"testing pinq_list_avail_gse\n"); verify_avail_gse(); break; default: tabort("ERROR: invalid argument \"%s\"\n",argv[i]); } } tendtest(); } /* * verify_ws_conn_type() */ static void verify_ws_conn_type() { Pconnid cid; err = BOGUSERR; pinq_ws_conn_type(1,BUFSIZE,&err,&cid,&wstype); ERROR("pinq_ws_conn_type"); if (cid != ws_connid) tfprintf("failed: workstation connection id=%d, expected %d\n", cid,ws_connid); } /* * verify_ws_cat */ static void verify_ws_cat() { Pws_cat cat; err = BOGUSERR; pinq_ws_cat(wstype,&err,&cat); ERROR("pinq_ws_category"); if (cat != wscat) tfprintf("failed: workstation category = %d, expected %d\n", cat, wscat); } /* * verify_ws_class */ static void verify_ws_class() { Pws_class class; err = BOGUSERR; pinq_ws_class(wstype,&err,&class); ERROR("pinq_ws_class"); if (class != wsclass) tfprintf("failed: workstation classification = %d, expected %d\n", class, wsclass); } /* * verify_def_disp_upd_st */ static void verify_def_disp_upd_st() { Pdefer_mode defer_mode; Pmod_mode mod_mode; err = BOGUSERR; pinq_def_disp_upd_st(wstype,&err,&defer_mode,&mod_mode); ERROR("pinq_def_disp_upd_st"); if (def_defer_mode != defer_mode) tfprintf("failed: default display deferral mode = %d, expected %d\n", defer_mode,def_defer_mode ); if (def_mod_mode != mod_mode) tfprintf("failed: default display modification mode = %d, expected %d\n", mod_mode,def_mod_mode); } /* * verify_avail_gse */ static void verify_avail_gse() { Pint_list gse,expgse; err = BOGUSERR; pinq_list_avail_gse(wstype,BUFSIZE,0,&err,&gse,&total); ERROR("pinq_list_avail_gse"); expgse.num_ints = num_gse; expgse.ints = list_gse; if (! i_compare_Pint_list(gse,expgse)) tfprintf("failed: list of available gse != expected \n"); } /* * verify_gdp */ static void verify_gdp() { Pint_list gdp,expgdp; Pint intbuf[BUFSIZE]; Pattrs attr[5]; int i,gdpid,num; gdp.ints = intbuf; err = BOGUSERR; pinq_list_avail_gdp(wstype,BUFSIZE,0,&err,&gdp,&total); ERROR("pinq_list_avail_gdp"); expgdp.num_ints = num_gdp; expgdp.ints = list_gdp; if (! i_compare_Pint_list(gdp,expgdp)) tfprintf("failed: available list of gdp != expected \n"); else for (i=0; i