/********************************************************
        This file is meant to try every error
     message that the idl front-end can generate.
        These errors are tested rule by rule.
*********************************************************/

/************************/
/* First, try each rule */
/************************/

/***  Test of rule 1 ***/

// An empty specification may be tested since it is not permitted

/***  Test of rule 2 ***/

Error
abstract Error
module mymodule {}

/***  Test of rule 3 ***/

module
module toto
module toto {};
module toto {};

/***  Test of rule 4 through 7 ***/ 

/* Test of rule Interface1 & 2 &3 */
interface
interface tata;
interface tata;
interface tata
interface tata{};
interface tutu{};
interface tata;
interface titi{}
abstract interface to;
interface to{};
abstract interface tu{};

/***  Test of rule 13 through 26 ***/

/* Test of rule Value2 */
custom
custom valuetype

/* Test of rule Value3 */
abstract
abstract valuetype
abstract valuetype toto

/* Test of rule Value4 */
valuetype
valuetype toto

/* Test of rule Value5 & Value6 */
valuetype toto {};
//valuetype titi supports toto

/* Test of rule Value7 */
valuetype toto;
valuetype forward_value;
valuetype forward_value;

/* Test of rule Value8 */
valuetype forward_value long;
valuetype toto long;
valuetype rightboxedvalue long;
//valuetype FooSeq sequence <FooSeq>;

/* Test of rule 19 */
/* test errors */
abstract valuetype value1 {};
abstract valuetype value2 : truncatable value1 {};
custom valuetype value3 : truncatable value1 {};
valuetype value4 {};
abstract valuetype value5 : value4 {};
valuetype value6 : truncatable value1 {};
valuetype value7;
valuetype value8 : value7 {};
valuetype value9 long;
valuetype value10 : value9 {};
interface valueinterface1 {};
valuetype value11 : valueinterface1 {};
valuetype value12 : {};
valuetype value13 : value1, value1 {};
valuetype value14 : value4, value4 {};
valuetype value15 : value4, value7 {};
valuetype value16 : value4, value9 {};
valuetype value17 : value4, valueinterface1 {};
valuetype value18 : value4, {};
interface valueinterface2;
valuetype value19 supports valueinterface2 {};
valuetype value20 supports value4 {};
valuetype value21 supports {};
interface valueinterface3 {};
valuetype value22 supports valueinterface1, valueinterface3 {};
valuetype value23 supports valueinterface1, valueinterface2 {};
valuetype value24 supports valueinterface1, value4 {};
valuetype value25 supports valueinterface1, {};
valuetype value26 : value1, value1 Error {};
/* test ok */
valuetype value30 : value4 {};
abstract valuetype value31 {};
valuetype value32 : value4, value1 {};

//valuetype value33 : value4, value1, value 31 {};

valuetype value34 : truncatable value4 {};
valuetype value35 : truncatable value4, value1 {};
valuetype value36 : truncatable value4, value1, value31 {};
abstract valuetype value37 : value1 {};
abstract valuetype value38 : value1, value31 {};
abstract interface valueinterface4 {};
abstract interface valueinterface5 {};
valuetype value39 supports valueinterface1 {};
valuetype value40 supports valueinterface1, valueinterface4 {};
valuetype value41 supports valueinterface1, valueinterface4, valueinterface5 {};
abstract valuetype value42 supports valueinterface1, valueinterface3 {};
abstract valuetype value43 supports valueinterface1, valueinterface3, valueinterface4 {};
abstract valuetype value44 supports valueinterface1, valueinterface3, valueinterface4, valueinterface5 {};

/* Test of rule 21 */
valuetype value45 { Error };

/* Test of rule 22 */
valuetype value45 { 
  private long[5]
};

/* Test of rule 23 */
valuetype value46 {
  factory 
  factory factory1 ();
  factory factory1 ();
  factory factory2
  factory factory3 (;
  factory factory4 ()
};

/* Test of rule 25 */
valuetype value47 {
  factory factory1 (out long l);
  factory factory2 (long l);
  factory factory3 (Error);
  factory factory4 (out long l, out l ll);
};

/* Test of rule 27 */
const boolean;
const boolean const1 = TRUE;
const boolean const1 = TRUE;
const boolean const2 TRUE;
const boolean const3;

/* Test of rule 28 */
typedef any any1;
const any1 const4 = TRUE;
const error;

/* Test of rule 29 */
const short const5 = 65000;
const unsigned short const6 = -17;
const long const7 = 4000000000;
const unsigned long const8 = -17;

/* Test of rule 30 */
const short const9 = 3 | 4;

/* Test of rule 31 */
const short const10 = 3 ^ 4;

/* Test of rule 32 */
const short const11 = 3 & 4;

/* Test of rule 33 */
const short const12 = 3 << 4;
const short const13 = 3 >> 4;

/* Test of rule 34 */
const short const14 = 3 + 4;
const short const15 = 3 - 4;

/* Test of rule 35 */
const short const16 = 3 * 4;
const short const17 = 3 / 4;
const short const18 = 3 % 4;

/* Test of rule 36-37 */
const short const19 = -3;
const short const20 = +3;
const short const21 = ~3;

/* Test of rule 38 */
const wchar const22 = L'X';
const wstring const23 = L"Wide string";
const fixed const24 = 4.05d;
const short const25 = ( 3 ;
const short const26 = const;

/* Test of rule 39 */
// nothing to be tested

/* Test of rule 40 */
// nothing to be tested

/* Test of rule 44 */
valuetype value48 {
  private Error;
};

/* Test of Rule 45 */
typedef sequence <Error>;

/* Test of rule 50 */
union union1 switch (boolean) {
  case TRUE : long ;
  default : short short1;
};

/* Test of rule 51 */
valuetype value49 {
  factory factory1 (in long);
  factory factory1 (in long l, in short l);
};

/* Test of rule 59 */
unsigned Error;

/* Test of rule 69 */
struct { long i;};
struct struct1 { long i; };
struct struct1 { long i; };
struct struct3 { long struct1; };
struct struct3 {;
struct struct4 { long struct4; };

/* Test of rule 70 */
struct struct5 {};

/* Test of rule 71 */
struct struct6 { long i };

/* Test of rule 72 */
union;
union union1 switch (boolean) { case true : long i; };
union union1 switch (boolean) { case true : long i; };
union union2;
union union3 switch;
union union4 switch (boolean {};
union union5 switch (boolean);
union union6 switch (boolean) { case true : long i; ;

/* Test of rule 73 */
union union7 switch (error) { case true : long i; };
typedef string string1;
union union8 switch (string1) { case true : long i; };

/* Test of rule 74 */
union union9 switch (boolean) { };
union union10 switch (boolean) {
    default : long i;
    default : short j;
};

/* Test of rule 75 */
union union11 switch (boolean) { error };
union union12 switch (boolean) { case true : long i };

/* Test of rule 76 */
union union13 switch (boolean) { case true : long i;
				 case true : long j; };
union union14 switch (boolean) { case true long k; };

/* Test of rule 78 */
enum;
enum enum1 { male, female };
enum enum1 { male, female };
enum enum2;
enum enum3 {};
enum enum4 { male, female ;

/* Test of rule 79 */
enum enum5 { , id };
enum enum6 { male , female };

/* Test of rule 80 */
typedef sequence sequence1;
typedef sequence <boolean sequence2;
typedef sequence <boolean, 8 sequence3;
typedef sequence <boolean, 8>> sequence4;
typedef sequence <sequence<boolean>> sequence5;

/* Test of rule 81 */
typedef string <10 string1;

/* Test of rule 82 */
typedef wstring <10 wstring1;

/* Test of rule 83 */
typedef boolean array1[2];
typedef boolean array1[2];

/* Test of rule 84 */
typedef boolean array2[3;

/* Test of rule 85 */      
interface toitoi{
attribute;
readonly error;
readonly attribute error;
readonly attribute long;
readonly attribute blurp;
readonly attribute long titi;
readonly attribute long titi;
readonly attribute long tutu, trotro;
readonly attribute long tutu,;
attribute string abab, obob;
};

/* Test of rule 86 */
exception;
exception etoto1;
exception etoto3};
exception etoto4{};
exception etoto4{};
exception etoto5{lbl};
exception etoto6{long };
exception etoto7{long truc};
exception etoto8{long truc;};
exception etoto8{long etoto8;};
	     
/* Test of rule 87 */
boolean;
oneway boolean;
boolean op1 ();
boolean op1 ();

/* Test of rule 89 */
oneway error;

/* Test of rule 90 */
boolean op2;
boolean op3 (;

/* Test of rule 91 */
boolean op4 (boolean);
boolean op5 (error);

/* Test of rule 92 */
boolean op6 (boolean b);

/* Test of rule 93 */
boolean op7 () raises;
boolean op8 () raises ();
boolean op9 raises (;

/* Test of rule 94 */
boolean op10 () context;
boolean op11 () context ();
boolean op12 context (;

/* Test of rule 95 */
boolean op13 (inout error);

/* Test of rule 96 */
typedef fixed fixed1;
typedef fixed <6> fixed2;
typedef fixed <6,7 fixed3;


/* Test of check_context_string */
boolean op14 () context ("0error");
boolean op15 () context ("eréror");
boolean op16 () context ("err*or");
boolean op17 () context ("erroré");

/* Test of eval_or_expr */
const integer c1 = TRUE | 2;
const integer c2 = 2 | true;
const integer c3 = 3 | -5;
const integer c4 = 10000000 | -5;


/*******************************/
/* Now, try each miscellaneous */
/*  point of the Idl langage   */
/*******************************/

// non defined forwarded interface and valuetype
module moduleA {
  valuetype valuetype1;
  interface interface1;
};

// recursive structures
module moduleB {  typedef short typeA;
  interface interfaceA {
    typedef moduleB::interfaceA typeD;
  };
};

// recursive structs
struct structA {
  structA s;
};

