01: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
02:
03: This file is part of the db4o open source object database.
04:
05: db4o is free software; you can redistribute it and/or modify it under
06: the terms of version 2 of the GNU General Public License as published
07: by the Free Software Foundation and as clarified by db4objects' GPL
08: interpretation policy, available at
09: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11: Suite 350, San Mateo, CA 94403, USA.
12:
13: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14: WARRANTY; without even the implied warranty of MERCHANTABILITY or
15: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: for more details.
17:
18: You should have received a copy of the GNU General Public License along
19: with this program; if not, write to the Free Software Foundation, Inc.,
20: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21: package com.db4o.db4ounit.common.types.arrays;
22:
23: import db4ounit.*;
24: import db4ounit.extensions.*;
25:
26: public class ArrayNOrderTestCase extends AbstractDb4oTestCase {
27:
28: public static class Data {
29: public String[][][] _strArr;
30: public Object[][] _objArr;
31:
32: public Data(String[][][] strArr, Object[][] objArr) {
33: this ._strArr = strArr;
34: this ._objArr = objArr;
35: }
36: }
37:
38: protected void store() {
39: String[][][] strArr = new String[2][2][3];
40: strArr[0][0][0] = "000";
41: strArr[0][0][1] = "001";
42: strArr[0][0][2] = "002";
43: strArr[0][1][0] = "010";
44: strArr[0][1][1] = "011";
45: strArr[0][1][2] = "012";
46: strArr[1][0][0] = "100";
47: strArr[1][0][1] = "101";
48: strArr[1][0][2] = "102";
49: strArr[1][1][0] = "110";
50: strArr[1][1][1] = "111";
51: strArr[1][1][2] = "112";
52:
53: Object[][] objArr = new Object[2][2];
54: objArr[0][0] = new Integer(0);
55: objArr[0][1] = "01";
56: objArr[1][0] = new Float(10);
57: objArr[1][1] = new Double(1.1);
58: db().set(new Data(strArr, objArr));
59: }
60:
61: public void test() {
62: Data data = (Data) retrieveOnlyInstance(Data.class);
63: check(data);
64: }
65:
66: public void check(Data data) {
67: Assert.areEqual("000", data._strArr[0][0][0]);
68: Assert.areEqual("001", data._strArr[0][0][1]);
69: Assert.areEqual("002", data._strArr[0][0][2]);
70: Assert.areEqual("010", data._strArr[0][1][0]);
71: Assert.areEqual("011", data._strArr[0][1][1]);
72: Assert.areEqual("012", data._strArr[0][1][2]);
73: Assert.areEqual("100", data._strArr[1][0][0]);
74: Assert.areEqual("101", data._strArr[1][0][1]);
75: Assert.areEqual("102", data._strArr[1][0][2]);
76: Assert.areEqual("110", data._strArr[1][1][0]);
77: Assert.areEqual("111", data._strArr[1][1][1]);
78: Assert.areEqual("112", data._strArr[1][1][2]);
79:
80: Assert.areEqual(new Integer(0), data._objArr[0][0]);
81: Assert.areEqual("01", data._objArr[0][1]);
82: Assert.areEqual(new Float(10), data._objArr[1][0]);
83: Assert.areEqual(new Double(1.1), data._objArr[1][1]);
84: }
85:
86: }
|