01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (license2)
04: * Initial Developer: H2 Group
05: */
06: package org.h2.test.unit;
07:
08: import org.h2.test.TestBase;
09: import org.h2.value.ValueUuid;
10:
11: /**
12: * Tests features of values.
13: */
14: public class TestValue extends TestBase {
15:
16: public void test() throws Exception {
17: testUUID();
18: }
19:
20: private void testUUID() throws Exception {
21: long maxHigh = 0, maxLow = 0, minHigh = -1L, minLow = -1L;
22: for (int i = 0; i < 100; i++) {
23: ValueUuid uuid = ValueUuid.getNewRandom();
24: maxHigh |= uuid.getHigh();
25: maxLow |= uuid.getLow();
26: minHigh &= uuid.getHigh();
27: minLow &= uuid.getLow();
28: }
29: ValueUuid max = ValueUuid.get(maxHigh, maxLow);
30: check(max.getString(), "ffffffff-ffff-4fff-bfff-ffffffffffff");
31: ValueUuid min = ValueUuid.get(minHigh, minLow);
32: check(min.getString(), "00000000-0000-4000-8000-000000000000");
33: }
34:
35: }
|