/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

Interface sample;

   Array  Integer(2) arrtype[10];

   Array <Set> Integer(2) arrsettype[10];

End;


main(argc,argv)
   int argc;
   char *argv[];
{
   arrtype arr_s, arr_r;
   arrsettype arrset_s, arrset_r;
   Data (sample) inst;

   if (argc != 2)
      exit(1);   

   arr_s[0] = 0x1234;
   arr_s[1] = 0x5678;
   arr_s[2] = - 0x1abc;
   arr_s[3] = - 0x5ef0;
   arr_s[4] = 0x7fff;

   arrset_s[0] = 0x1234;
   arrset_s[1] = 0x5678;
   arrset_s[2] = - 0x1abc;
   arrset_s[3] = - 0x5ef0;
   arrset_s[4] = 0x7fff;

/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber);
   Encode inst
   {
      arr_s => arrtype;
   }
   Unbind(inst);

/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber);
   Decode inst
      {
	 On arrtype => (arr_r);
      }
   Unbind(inst);

/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber);
   Encode inst
   {
      arrset_s => arrsettype;
   }
   Unbind(inst);

/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber);
   Decode inst
      {
	 On arrsettype => (arrset_r);
      }
   Unbind(inst);

/***************** report results *********************/

   if (arr_s[0] != arr_r[0] ||
       arr_s[1] != arr_r[1] ||
       arr_s[2] != arr_r[2] ||
       arr_s[3] != arr_r[3] ||
       arr_s[4] != arr_r[4]) {
      printf("   array values were bad\n");
      exit(1);
   }
   if (arrset_s[0] != arrset_r[0] ||
       arrset_s[1] != arrset_r[1] ||
       arrset_s[2] != arrset_r[2] ||
       arrset_s[3] != arrset_r[3] ||
       arrset_s[4] != arrset_r[4]) {
      printf("   array values were bad\n");
      exit(1);
   }

   printf("test completed\n");
   return(0);
}
