public PrimitiveTypes(PrimitiveTypes rhs) { this.boolValValue = rhs.boolValValue; this.byteValValue = rhs.byteValValue; this.charValValue = rhs.charValValue; this.shortValValue = rhs.shortValValue; this.intValValue = rhs.intValValue; this.longValValue = rhs.longValValue; this.floatValValue = rhs.floatValValue; this.doubleValValue = rhs.doubleValValue; this.stringValValue = rhs.stringValValue; this.dateValValue = rhs.dateValValue; this.objValValue = rhs.objValValue; this.objVal2Value = rhs.objVal2Value; this.valueValue = rhs.valueValue; this.tempValue = rhs.tempValue; }
private void internalTestPerformance(BBinaryModel bmodel, int gzip, int loopCount, int objCount) { BClient_Testser client = TestUtilsHttp.createClient(); PrimitiveTypes[] primitiveTypes1 = new PrimitiveTypes[objCount]; for (int i = 0; i < primitiveTypes1.Length; i++) { primitiveTypes1[i] = TestUtils.createObjectPrimitiveTypes(); } long t1 = DateTime.Now.Ticks; for (int i = 0; i < loopCount; i++) { client.RemoteArrayTypes1dim.SetPrimitiveTypes(primitiveTypes1); } long t2 = DateTime.Now.Ticks; long t3 = DateTime.Now.Ticks; for (int i = 0; i < loopCount; i++) { client.RemoteArrayTypes1dim.GetPrimitiveTypes(); } long t4 = DateTime.Now.Ticks; client.done(); t1 /= 10000; t2 /= 10000; t3 /= 10000; t4 /= 10000; log.info("bmodel=" + bmodel.ToString().Substring(0,2) + ", gzip=" + gzip + ", #objs=" + objCount.ToString("000000") + ", #loops=" + loopCount.ToString("000000") + ", call-ms=" + ((t2 - t1) + (t4 - t3)).ToString("000000") + "/" + (t2 - t1).ToString("000000") + "/" + (t4 - t3).ToString("000000") ); }
private static PrimitiveTypes internalCreateObjectPrimitiveTypes(bool inclObjVal) { PrimitiveTypes p = new PrimitiveTypes(); p.BoolVal = (createCount & 1) != 0; p.IntVal = ++createCount * (p.BoolVal ? -1 : 1); p.ByteVal = (byte)createCount; p.ShortVal = (short)((createCount * 31) * (p.BoolVal ? -1 : 1)); p.LongVal = createCount * 129 * (p.BoolVal ? -1 : 1); p.FloatVal = ((float)createCount) * 3 * (p.BoolVal ? -1 : 1); p.DoubleVal = (double)createCount * 7 * (p.BoolVal ? -1 : 1); p.StringVal = Convert.ToString(p.IntVal); if (inclObjVal) { p.ObjVal = internalCreateObjectPrimitiveTypes(false); } p.ObjVal2 = p; return p; }
public static bool comparePrimitiveTypes(PrimitiveTypes lhs, PrimitiveTypes rhs) { if (lhs == rhs) return true; if (rhs == null) return false; if (lhs.BoolVal != rhs.BoolVal) return false; if (lhs.ByteVal != rhs.ByteVal) return false; if (lhs.CharVal != rhs.CharVal) return false; if (lhs.DoubleVal != rhs.DoubleVal) return false; if (lhs.FloatVal != rhs.FloatVal) return false; if (lhs.IntVal != rhs.IntVal) return false; if (lhs.LongVal != rhs.LongVal) return false; if (lhs.ShortVal != rhs.ShortVal) return false; if (!(lhs.StringVal != null ? lhs.StringVal : "").Equals(rhs.StringVal != null ? rhs.StringVal : "")) return false; return true; }
public void testRemoteArrayTypes1dim() { log.info("testRemoteArrayTypes1dim("); RemoteArrayTypes1dim remote; remote = client.RemoteArrayTypes1dim; bool[] bool1 = new bool[] {true, false, true}; byte[] byte1 = new byte[] {1,2,3}; char[] char1 = new char[] {'a', 'b', 'c' }; short[] short1 = new short[] { 55,66,77}; int[] int1 = new int[] {12,34,56}; long[] long1 = new long[] {999,88,7}; float[] float1 = new float[] {1.2f, 2.2f, 3.2f}; double[] double1 = new double[] {1e1, 1e2, 1e3}; String[] string1 = new String[] {"ôôôô"}; DateTime[] date1 = new DateTime[] { new DateTime(2012, 2, 29, 1, 2, 3, 4), new DateTime() }; PrimitiveTypes[] primitiveTypes1 = new PrimitiveTypes[] { TestUtils.createObjectPrimitiveTypes() }; Object[] object1 = new ArrayTypes1dim[] { new ArrayTypes1dim() }; remote.SetBool(bool1); TestUtils.assertEquals(log, "bool", bool1, remote.GetBool()); remote.SetByte(byte1); TestUtils.assertEquals(log, "byte", byte1, remote.GetByte()); remote.SetChar(char1); TestUtils.assertEquals(log, "char", char1, remote.GetChar()); remote.SetShort(short1); TestUtils.assertEquals(log, "short", short1, remote.GetShort()); remote.SetInt(int1); TestUtils.assertEquals(log, "int", int1, remote.GetInt()); remote.SetLong(long1); TestUtils.assertEquals(log, "long", long1, remote.GetLong()); remote.SetFloat(float1); TestUtils.assertEquals(log, "float", float1, remote.GetFloat()); remote.SetDouble(double1); TestUtils.assertEquals(log, "double", double1, remote.GetDouble()); remote.SetString(string1); TestUtils.assertEquals(log, "String", string1, remote.GetString()); remote.SetDate(date1); TestUtils.assertEquals(log, "date", date1, remote.GetDate()); remote.SetObject(object1); TestUtils.assertEquals(log, "Object", object1, remote.GetObject()); remote.SetPrimitiveTypes(primitiveTypes1); TestUtils.assertEquals(log, "PrimitiveTypes", primitiveTypes1, remote.GetPrimitiveTypes()); log.info(")testRemoteArrayTypes1dim"); }
public void testRemoteArraysDims23() { log.info("testRemoteArraysDims23("); RemoteArrayTypes23 remote; remote = client.RemoteArrayTypes23; { int[] arr1 = new int[3]; int[,] arr2 = new int[7,6]; int[,,] arr3 = new int[7,5,3]; int[,,,] arr4 = new int[3,4,6,7]; for (int i2 = 0; i2 < arr2.GetLength(0); i2++) for (int i1 = 0; i1 < arr2.GetLength(1); i1++) arr2[i2,i1] = i2+i1; for (int i3 = 0; i3 < arr3.GetLength(0); i3++) for (int i2 = 0; i2 < arr3.GetLength(1); i2++) for (int i1 = 0; i1 <arr3.GetLength(2); i1++) arr3[i3,i2,i1] = i3+i2+i1; for (int i4 = 0; i4 < arr4.GetLength(0); i4++) for (int i3 = 0; i3 < arr4.GetLength(1); i3++) for (int i2 = 0; i2 < arr4.GetLength(2); i2++) for (int i1 = 0; i1 < arr4.GetLength(3); i1++) arr4[i4,i3,i2,i1] = i4+i3+i2+i1; arr1[0] = arr2[1,1]; arr1[1] = arr3[1,1,1]; arr1[2] = arr4[1,1,1,1]; int[] arrR = remote.SendArraysInt(arr2, arr3, arr4); TestUtils.assertEquals(log, "int", arr1, arrR); } { String[] arr1 = new String[3]; String[,] arr2 = new String[7,6]; String[,,] arr3 = new String[7,5,3]; String[,,,] arr4 = new String[3,4,6,7]; for (int i2 = 0; i2 < arr2.GetLength(0); i2++) for (int i1 = 0; i1 < arr2.GetLength(1); i1++) arr2[i2,i1] = ""+i2+i1; for (int i3 = 0; i3 < arr3.GetLength(0); i3++) for (int i2 = 0; i2 < arr3.GetLength(1); i2++) for (int i1 = 0; i1 <arr3.GetLength(2); i1++) arr3[i3,i2,i1] = ""+i3+i2+i1; for (int i4 = 0; i4 < arr4.GetLength(0); i4++) for (int i3 = 0; i3 < arr4.GetLength(1); i3++) for (int i2 = 0; i2 < arr4.GetLength(2); i2++) for (int i1 = 0; i1 < arr4.GetLength(3); i1++) arr4[i4,i3,i2,i1] = ""+i4+i3+i2+i1; arr1[0] = arr2[1,1]; arr1[1] = arr3[1,1,1]; arr1[2] = arr4[1,1,1,1]; String[] arrR = remote.SendArraysString(arr2, arr3, arr4); TestUtils.assertEquals(log, "String", arr1, arrR); } { PrimitiveTypes[] arr1 = new PrimitiveTypes[3]; PrimitiveTypes[,] arr2 = new PrimitiveTypes[7,6]; PrimitiveTypes[,,] arr3 = new PrimitiveTypes[7,5,3]; PrimitiveTypes[,,,] arr4 = new PrimitiveTypes[3,4,6,7]; for (int i2 = 0; i2 < arr2.GetLength(0); i2++) for (int i1 = 0; i1 < arr2.GetLength(1); i1++) arr2[i2,i1] = TestUtils.createObjectPrimitiveTypes(); for (int i3 = 0; i3 < arr3.GetLength(0); i3++) for (int i2 = 0; i2 < arr3.GetLength(1); i2++) for (int i1 = 0; i1 <arr3.GetLength(2); i1++) arr3[i3,i2,i1] = TestUtils.createObjectPrimitiveTypes(); for (int i4 = 0; i4 < arr4.GetLength(0); i4++) for (int i3 = 0; i3 < arr4.GetLength(1); i3++) for (int i2 = 0; i2 < arr4.GetLength(2); i2++) for (int i1 = 0; i1 < arr4.GetLength(3); i1++) arr4[i4,i3,i2,i1] = TestUtils.createObjectPrimitiveTypes(); arr1[0] = arr2[1,1]; arr1[1] = arr3[1,1,1]; arr1[2] = arr4[1,1,1,1]; PrimitiveTypes[] arrR = remote.SendArraysClass(arr2, arr3, arr4); TestUtils.assertEquals(log, "PrimitiveTypes", arr1, arrR); } { Object[] arr1 = new Object[3]; Object[,] arr2 = new Object[7,6]; Object[,,] arr3 = new Object[7,5,3]; Object[,,,] arr4 = new Object[3,4,6,7]; for (int i2 = 0; i2 < arr2.GetLength(0); i2++) for (int i1 = 0; i1 < arr2.GetLength(1); i1++) arr2[i2,i1] = TestUtils.createObjectPrimitiveTypes(); for (int i3 = 0; i3 < arr3.GetLength(0); i3++) for (int i2 = 0; i2 < arr3.GetLength(1); i2++) for (int i1 = 0; i1 <arr3.GetLength(2); i1++) arr3[i3,i2,i1] = TestUtils.createObjectPrimitiveTypes(); for (int i4 = 0; i4 < arr4.GetLength(0); i4++) for (int i3 = 0; i3 < arr4.GetLength(1); i3++) for (int i2 = 0; i2 < arr4.GetLength(2); i2++) for (int i1 = 0; i1 < arr4.GetLength(3); i1++) arr4[i4,i3,i2,i1] = TestUtils.createObjectPrimitiveTypes(); arr1[0] = arr2[1,1]; arr1[1] = arr3[1,1,1]; arr1[2] = arr4[1,1,1,1]; Object[] arrR = remote.SendArraysObject(arr2, arr3, arr4); TestUtils.assertEquals(log, "Object", arr1, arrR); } { Point2D[] arr1 = new Point2D[3]; Point2D[,] arr2 = new Point2D[7,6]; Point2D[,,] arr3 = new Point2D[7,5,3]; Point2D[,,,] arr4 = new Point2D[3,4,6,7]; for (int i2 = 0; i2 < arr2.GetLength(0); i2++) for (int i1 = 0; i1 < arr2.GetLength(1); i1++) arr2[i2,i1] = TestUtils.createPoint2D(); for (int i3 = 0; i3 < arr3.GetLength(0); i3++) for (int i2 = 0; i2 < arr3.GetLength(1); i2++) for (int i1 = 0; i1 <arr3.GetLength(2); i1++) arr3[i3,i2,i1] = TestUtils.createPoint2D(); for (int i4 = 0; i4 < arr4.GetLength(0); i4++) for (int i3 = 0; i3 < arr4.GetLength(1); i3++) for (int i2 = 0; i2 < arr4.GetLength(2); i2++) for (int i1 = 0; i1 < arr4.GetLength(3); i1++) arr4[i4,i3,i2,i1] = TestUtils.createPoint2D(); arr1[0] = arr2[1,1]; arr1[1] = arr3[1,1,1]; arr1[2] = arr4[1,1,1,1]; Point2D[] arrR = remote.SendArraysInline(arr2, arr3, arr4); TestUtils.assertEquals(log, "Point2D", arr1, arrR); } log.info(")testRemoteArraysDims23"); }