예제 #1
0
파일: testA.cs 프로젝트: xrl/opensplice
 public static string TestInit(testDefConstr.A sample)
 {
     if (sample.id != 0)
     {
         return "Expected: id == 0; Received: " + sample.id;
     }
     if (sample.Name == null)
     {
         return "name == null";
     }
     if (!sample.Name.Equals(string.Empty))
     {
         return "Expected: name == \"\"; Received: \"" + sample.Name + "\"";
     }
     if (sample.embedded == null)
     {
         return "embedded == null";
     }
     if (sample.embedded.x != 0)
     {
         return "Expected: embedded.x == 0; Received: " + sample.embedded.x;
     }
     if (sample.embedded.y != 0)
     {
         return "Expected: embedded.y == 0; Received: " + sample.embedded.y;
     }
     if (sample.embedded.z != 0)
     {
         return "Expected: embedded.z == 0; Received: " + sample.embedded.z;
     }
     if (sample.c != testDefConstr.Color.Red)
     {
         return "Expected: c == 0; Received: " + sample.c.Value();
     }
     if (sample.nums == null)
     {
         return "nums == null";
     }
     if (sample.nums.Length != testDefConstr.DIM_NUMS_1.Value)
     {
         return "Expected nums.length == " + testDefConstr.DIM_NUMS_1.Value + "; Received: "
              + sample.nums.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_NUMS_1.Value; i++)
     {
         if (sample.nums[i].Length != testDefConstr.DIM_NUMS_2.Value)
         {
             return "Expected nums[" + i + "].length == " + testDefConstr.DIM_NUMS_2.Value + "; Received: "
                  + sample.nums[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_NUMS_2.Value; j++)
         {
             if (sample.nums[i][j] != 0)
             {
                 return "Expected sample.nums[" + i + "][" + j + "] == 0" + "; Received: " + sample
                     .nums[i][j];
             }
         }
     }
     if (sample.nums2 == null)
     {
         return "sample.nums2 == null";
     }
     if (sample.nums2.Length != 0)
     {
         return "Expected nums2.length == 0; Received: " + sample.nums2.Length;
     }
     if (sample.floatList == null)
     {
         return "floatList == null";
     }
     if (sample.floatList.Length != 0)
     {
         return "Expected floatList.length == 0; Received: " + sample.floatList.Length;
     }
     if (sample.la2Dim == null)
     {
         return "la2Dim == null";
     }
     if (sample.la2Dim.Length != testDefConstr.DIM_LA2DIM_1.Value)
     {
         return "Expected la2Dim.length == " + testDefConstr.DIM_LA2DIM_1.Value + "; Received: "
              + sample.la2Dim.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_LA2DIM_1.Value; i++)
     {
         if (sample.la2Dim[i].Length != testDefConstr.DIM_LONGARRAY10_1.Value)
         {
             return "Expected la2Dim[" + i + "].length == " + testDefConstr.DIM_LONGARRAY10_1.
                 Value + "; Received: " + sample.la2Dim[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_LONGARRAY10_1.Value; j++)
         {
             if (sample.la2Dim[i][j] != 0)
             {
                 return "Expected la2Dim[" + i + "][" + j + "] == 0" + "; Received: " + sample.la2Dim
                     [i][j];
             }
         }
     }
     return null;
 }
예제 #2
0
 public static string TestInit(testDefConstr.TestUnionStarts sample)
 {
     if (sample.id != 0)
     {
         return "Expected: id == 0; Received: " + sample.id;
     }
     if (sample.usstring == null)
     {
         return "usstring == null";
     }
     if (sample.usstring.Discriminator() != testDefConstr.Size.LARGE)
     {
         return "Expected: usstring.discriminator() == " + testDefConstr.Size.LARGE.Value(
             ) + "; Received: " + sample.usstring.Discriminator().Value();
     }
     if (sample.usstring.Name() == null)
     {
         return "usstring.Name() == null";
     }
     if (!sample.usstring.Name().Equals(string.Empty))
     {
         return "Expected: usstring.Name() == \"\"; Received: \"" + sample.usstring.Name()
              + "\"";
     }
     if (sample.usmds == null)
     {
         return "usmds == null";
     }
     if (sample.usmds.Discriminator() != testDefConstr.Size.MEDIUM)
     {
         return "Expected: usmds.discriminator() == " + testDefConstr.Size.MEDIUM.Value()
             + "; Received: " + sample.usmds.Discriminator().Value();
     }
     if (sample.usmds.ThreeDimA() == null)
     {
         return "usmds.threeDimA() == null";
     }
     if (sample.usmds.ThreeDimA().Length != testDefConstr.DIM_THREEDIMA_1.Value)
     {
         return "Expected usmds.threeDimA().length == " + testDefConstr.DIM_THREEDIMA_1.Value
              + "; Received: " + sample.usmds.ThreeDimA().Length;
     }
     for (int i = 0; i < testDefConstr.DIM_THREEDIMA_1.Value; i++)
     {
         if (sample.usmds.ThreeDimA()[i].Length != testDefConstr.DIM_THREEDIMA_2.Value)
         {
             return "Expected usmds.threeDimA()[" + i + "].length == " + testDefConstr.DIM_THREEDIMA_2
                 .Value + "; Received: " + sample.usmds.ThreeDimA()[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_THREEDIMA_2.Value; j++)
         {
             if (sample.usmds.ThreeDimA()[i][j].Length != testDefConstr.DIM_ARRAYA_1.Value)
             {
                 return "Expected usmds.threeDimA()[" + i + "][" + j + "].length == " + testDefConstr.DIM_ARRAYA_1
                     .Value + "; Received: " + sample.usmds.ThreeDimA()[i][j].Length;
             }
             for (int k = 0; k < testDefConstr.DIM_ARRAYA_1.Value; k++)
             {
                 if (sample.usmds.ThreeDimA()[i][j][k] == null)
                 {
                     return "usmds.threeDimA()[" + i + "][" + j + "][" + k + "] == null";
                 }
                 string message = saj.testA.TestInit(sample.usmds.ThreeDimA()[i][j][k]);
                 if (message != null)
                 {
                     return "In message usmds.threeDimA()[" + i + "][" + j + "][" + k + "]: " + message;
                 }
             }
         }
     }
     if (sample.usmdp == null)
     {
         return "usmdp == null";
     }
     if (sample.usmdp.Discriminator() != testDefConstr.Size.MEDIUM)
     {
         return "Expected: usmdp.discriminator() == " + testDefConstr.Size.MEDIUM.Value()
             + "; Received: " + sample.usmdp.Discriminator().Value();
     }
     if (sample.usmdp.TwoDimLong() == null)
     {
         return "usmdp.twoDimLong() == null";
     }
     if (sample.usmdp.TwoDimLong().Length != testDefConstr.DIM_TWODIMLONG_1.Value)
     {
         return "Expected usmdp.twoDimLong().length == " + testDefConstr.DIM_TWODIMLONG_1.
             Value + "; Received: " + sample.usmdp.TwoDimLong().Length;
     }
     for (int i = 0; i < testDefConstr.DIM_TWODIMLONG_1.Value; i++)
     {
         if (sample.usmdp.TwoDimLong()[i].Length != testDefConstr.DIM_LONGARRAY10_1.Value)
         {
             return "Expected usmdp.twoDimLong()[" + i + "].length == " + testDefConstr.DIM_LONGARRAY10_1
                 .Value + "; Received: " + sample.usmdp.TwoDimLong()[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_LONGARRAY10_1.Value; j++)
         {
             if (sample.usmdp.TwoDimLong()[i][j] != 0)
             {
                 return "Expected usmdp.twoDimLong()[" + i + "][" + j + "] == 0" + "; Received: "
                     + sample.usmdp.TwoDimLong()[i][j];
             }
         }
     }
     if (sample.use == null)
     {
         return "use == null";
     }
     if (sample.use.Discriminator() != testDefConstr.Color.Red)
     {
         return "Expected: use.discriminator() == " + testDefConstr.Color.Red.Value() + "; Received: "
              + sample.use.Discriminator().Value();
     }
     if (sample.use.MySize() != testDefConstr.Size.LARGE)
     {
         return "Expected: use.mySize() == " + testDefConstr.Size.LARGE.Value() + "; Received: "
              + sample.use.MySize().Value();
     }
     if (sample.usstruct == null)
     {
         return "usstruct == null";
     }
     if (sample.usstruct.Discriminator() != testDefConstr.Color.Red)
     {
         return "Expected: usstruct.discriminator() == " + testDefConstr.Color.Red.Value()
              + "; Received: " + sample.usstruct.Discriminator().Value();
     }
     if (sample.usstruct.MyB() == null)
     {
         return "usstruct.myB() == null";
     }
     if (sample.usstruct.MyB().x != 0)
     {
         return "Expected: usstruct.myB().x == 0; Received: " + sample.usstruct.MyB().x;
     }
     if (sample.usstruct.MyB().y != 0)
     {
         return "Expected: usstruct.myB().y == 0; Received: " + sample.usstruct.MyB().y;
     }
     if (sample.usstruct.MyB().z != 0)
     {
         return "Expected: usstruct.myB().z == 0; Received: " + sample.usstruct.MyB().z;
     }
     if (sample.usseq == null)
     {
         return "usseq == null";
     }
     if (sample.usseq.Discriminator() != testDefConstr.Color.Red)
     {
         return "Expected: usseq.discriminator() == " + testDefConstr.Color.Red.Value() +
             "; Received: " + sample.usseq.Discriminator().Value();
     }
     if (sample.usseq.NoInitRequired() == null)
     {
         return "usseq.noInitRequired() == null";
     }
     if (sample.usseq.NoInitRequired().Length != 0)
     {
         return "Expected usseq.noInitRequired().length == 0; Received: " + sample.usseq.NoInitRequired
             ().Length;
     }
     if (sample.uspd == null)
     {
         return "uspd == null";
     }
     if (sample.uspd.Discriminator() != testDefConstr.Color.Red)
     {
         return "Expected: uspd.discriminator() == " + testDefConstr.Color.Red.Value() + "; Received: "
              + sample.uspd.Discriminator().Value();
     }
     if (sample.uspd.D() != 0)
     {
         return "Expected: uspd.d() == 0; Received: " + sample.uspd.D();
     }
     if (sample.uspc == null)
     {
         return "uspc == null";
     }
     if (sample.uspc.Discriminator() != testDefConstr.Color.Red)
     {
         return "Expected: uspc.discriminator() == " + testDefConstr.Color.Red.Value() + "; Received: "
              + sample.uspc.Discriminator().Value();
     }
     if (sample.uspc.C() != '\0')
     {
         return "Expected: uspc.c() == '\\0'; Received: " + sample.uspc.C();
     }
     return null;
 }
예제 #3
0
 public static string TestInit(testDefConstr.StructBigTest sample)
 {
     if (sample.id != 0)
     {
         return "Expected: id == 0; Received: " + sample.id;
     }
     if (sample.someLongArr == null)
     {
         return "someLongArr == null";
     }
     if (sample.someLongArr.Length != testDefConstr.DIM_LONG1ARR_1.Value)
     {
         return "Expected someLongArr.length == " + testDefConstr.DIM_LONG1ARR_1.Value + "; Received: "
              + sample.someLongArr.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_LONG1ARR_1.Value; i++)
     {
         if (sample.someLongArr[i] != 0)
         {
             return "Expected someLongArr[" + i + "] == 0; Received: " + sample.someLongArr[i];
         }
     }
     if (sample.someLong != 0)
     {
         return "Expected: someLong == 0; Received: " + sample.someLong;
     }
     if (sample.val == null)
     {
         return "val == null";
     }
     if (!sample.val.Equals(string.Empty))
     {
         return "Expected: val == \"\"; Received: \"" + sample.val + "\"";
     }
     if (sample.SomeOctet != 0)
     {
         return "Expected: SomeOctet == 0; Received: " + sample.SomeOctet;
     }
     if (sample.mySize.Value() != 0)
     {
         return "Expected mySize.Value() == 0; Received: " + sample.mySize.Value();
     }
     if (sample.someSeq == null)
     {
         return "someSeq == null";
     }
     if (sample.someSeq.Length != testDefConstr.DIM_AAPSEQARR12_1.Value)
     {
         return "Expected someSeq.length == " + testDefConstr.DIM_AAPSEQARR12_1.Value + "; Received: "
              + sample.someSeq.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_AAPSEQARR12_1.Value; i++)
     {
         if (sample.someSeq[i] == null)
         {
             return "someSeq[" + i + "] == null";
         }
         if (sample.someSeq[i].Length != 0)
         {
             return "Expected someSeq[" + i + "].length == 0; Received: " + sample.someSeq[i].
                 Length;
         }
     }
     if (sample.someUnion == null)
     {
         return "someUnion == null";
     }
     if (sample.someUnion.Discriminator() != 0)
     {
         return "Expected: someUnion.discriminator() == 0; Received: " + sample.someUnion.
             Discriminator();
     }
     if (sample.someUnion.Case1() != '\0')
     {
         return "someUnion.case1() != '\\0'";
     }
     if (sample.someSeq2 == null)
     {
         return "someSeq2 == null";
     }
     if (sample.someSeq2.Length != 0)
     {
         return "Expected someSeq2.length == 0; Received: " + sample.someSeq2.Length;
     }
     if (sample.mySize2 == null)
     {
         return "mySize2 == null";
     }
     if (sample.mySize2.Length != 0)
     {
         return "Expected mySize2.length == 0; Received: " + sample.mySize2.Length;
     }
     if (sample.someUnion3 == null)
     {
         return "someUnion3 == null";
     }
     if (sample.someUnion3.Length != testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_1.Value)
     {
         return "Expected someUnion3.length == " + testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_1
             .Value + "; Received: " + sample.someUnion3.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_1.Value; i++)
     {
         if (sample.someUnion3[i] == null)
         {
             return "someUnion3[" + i + "] == null";
         }
         if (sample.someUnion3[i].Length != testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_2.Value)
         {
             return "Expected someUnion3[" + i + "].length == " + testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_2
                 .Value + "; Received: " + sample.someUnion3[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_BIGUNIONSEQSEQARR1ARR2_2.Value; j++)
         {
             if (sample.someUnion3[i][j] == null)
             {
                 return "someUnion3[" + i + "][" + j + "] == null";
             }
             if (sample.someUnion3[i][j].Length != 0)
             {
                 return "Expected someUnion3[" + i + "][" + j + "].length == 0" + "; Received: " +
                      sample.someUnion3[i][j].Length;
             }
         }
     }
     if (sample.arrTest == null)
     {
         return "arrTest == null";
     }
     if (sample.arrTest.Length != testDefConstr.DIM_LONG1ARR43ARR2ARR_1.Value)
     {
         return "Expected someUnion3.length == " + testDefConstr.DIM_LONG1ARR43ARR2ARR_1.Value
              + "; Received: " + sample.arrTest.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_LONG1ARR43ARR2ARR_1.Value; i++)
     {
         if (sample.arrTest[i] != 0)
         {
             return "Expected: arrTest[" + i + "] == 0; Received: " + sample.arrTest[i];
         }
     }
     if (sample.erik == null)
     {
         return "erik == null";
     }
     if (sample.erik.Length != testDefConstr.DIM_ERIK_1.Value)
     {
         return "Expected erik.length == " + testDefConstr.DIM_ERIK_1.Value + "; Received: "
              + sample.erik.Length;
     }
     for (int i = 0; i < testDefConstr.DIM_ERIK_1.Value; i++)
     {
         if (sample.erik[i] == null)
         {
             return "erik[" + i + "] == null";
         }
         if (sample.erik[i].Length != testDefConstr.DIM_ERIK_2.Value)
         {
             return "Expected erik[" + i + "].length == " + testDefConstr.DIM_ERIK_2.Value + "; Received: "
                  + sample.erik[i].Length;
         }
         for (int j = 0; j < testDefConstr.DIM_ERIK_2.Value; j++)
         {
             if (sample.erik[i][j] == null)
             {
                 return "erik[" + i + "][" + j + "] == null";
             }
             if (sample.erik[i][j].Length != testDefConstr.DIM_ARRAYA_1.Value)
             {
                 return "Expected erik[" + i + "][" + j + "].length == " + testDefConstr.DIM_ARRAYA_1
                     .Value + "; Received: " + sample.erik[i][j].Length;
             }
             for (int k = 0; k < testDefConstr.DIM_ARRAYA_1.Value; k++)
             {
                 if (sample.erik[i][j][k] == null)
                 {
                     return "erik[" + i + "][" + j + "][" + k + "] == null";
                 }
                 string message = saj.testA.TestInit(sample.erik[i][j][k]);
                 if (message != null)
                 {
                     return "In message erik[" + i + "][" + j + "][" + k + "]: " + message;
                 }
             }
         }
     }
     return null;
 }