/********************************************************
        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{};
interface tirli : to, to {};

/* test of rule 11 */
interface int1 : toto {};

/* test of rule 12 */
interface i : { const long a = 5;};
typedef does_not_exist a1;
const long not_a_scope = 5;
typedef not_a_scope::l a2;
interface ii { const long a = 5;};
typedef ii:: ;
typedef ii::does_not_exist a3;
typedef ii::a::b a4;
struct structA {
  structA s;
};

/***  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 {};
abstract interface valueinterface4 {};
valuetype value27 : value1, value1 supports valueinterface4, valueinterface4 {};

/* Test of rule 20 */
valuetype value27 : toto {};

/* 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;
const toto a = 6;

/* 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;
const short const26 = toto;

/* 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 <>;
interface not_a_type { void echo (); };
typedef not_a_type type1;

/* 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 (;
const long const27 = 5;
boolean op10 raises (const27);

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

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

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


/* Test of check_context_string */
boolean op15 () context ("0error");
boolean op16 () context ("eréror");
boolean op17 () context ("err*or");
boolean op18 () 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 short typeC;
    typedef moduleB::interfaceA::typeC typeD;
  };
};

// multiple inheritance management
// in case of interfaces
interface i1 {
  typedef long type1;
  const long const1 = 5;
  exception e {};
};
interface i2 {
  typedef short type1;
  const long const1 = 7;
  exception e {};
};
interface i3 : i1, i2 {
  typedef type1 type2;
  const long const2 = const1;
  void echo () raises (e);
};
interface i4 {
  attribute long l;
  void echo ();
};
interface i5 : i4 {
  attribute long l;
  void echo (long arg);
};
interface i6 {
  attribute long l;
  void echo ();
};
interface i7 : i4, i6 {};

// multiple inheritance management
// in case of valuetypes
valuetype v1 {
  typedef long type1;
  const long const1 = 5;
  exception e {};
};
abstract valuetype v2 {
  typedef short type1;
  const long const1 = 7;
  exception e {};
};
valuetype v3 : v1, v2 {
  typedef type1 type2;
  const long const2 = const1;
  void echo () raises (e);
};
valuetype v4 {
  attribute long l;
  void echo ();
};
valuetype v5 : v4 {
  attribute long l;
  void echo (long arg);
};
