01: /*
02: Copyright (C) 2007 Mobixess Inc. http://www.java-objects-database.com
03:
04: This file is part of the JODB (Java Objects Database) open source project.
05:
06: JODB is free software; you can redistribute it and/or modify it under
07: the terms of version 2 of the GNU General Public License as published
08: by the Free Software Foundation.
09:
10: JODB is distributed in the hope that it will be useful, but WITHOUT ANY
11: WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: for more details.
14:
15: You should have received a copy of the GNU General Public License along
16: with this program; if not, write to the Free Software Foundation, Inc.,
17: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19: package com.mobixess.jodb.tests;
20:
21: import com.mobixess.jodb.core.query.LArrayChunkedBuffer;
22:
23: public class UnitTests {
24:
25: /**
26: * @param args
27: */
28: public static void main(String[] args) {
29: testLongChunkBuffer();
30: }
31:
32: public static void testLongChunkBuffer() {
33: LArrayChunkedBuffer arrayChunkedBuffer = new LArrayChunkedBuffer();
34: if (arrayChunkedBuffer.hasNext()) {
35: throw new RuntimeException();
36: }
37: int max = 2000;
38: for (int i = 0; i < max; i++) {
39: arrayChunkedBuffer.add(i);
40: }
41:
42: for (int i = 0; i < max; i++) {
43: if (!arrayChunkedBuffer.hasNext()) {
44: throw new RuntimeException();
45: }
46: if (arrayChunkedBuffer.next() != i) {
47: throw new RuntimeException();
48: }
49: }
50: }
51:
52: }
|