示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void minimalSplitterForSameValueShouldDivideLeftAndRight()
        internal virtual void MinimalSplitterForSameValueShouldDivideLeftAndRight()
        {
            // Given
            StringLayout   layout          = new StringLayout();
            StringIndexKey left            = layout.NewKey();
            StringIndexKey right           = layout.NewKey();
            StringIndexKey minimalSplitter = layout.NewKey();

            // keys with same value but different entityId
            TextValue value = _random.randomValues().nextTextValue();

            left.Initialize(1);
            right.Initialize(2);
            left.initFromValue(0, value, NEUTRAL);
            right.initFromValue(0, value, NEUTRAL);

            // When creating minimal splitter
            layout.MinimalSplitter(left, right, minimalSplitter);

            // Then that minimal splitter need to correctly divide left and right
            assertTrue(layout.Compare(left, minimalSplitter) < 0, "Expected minimal splitter to be strictly greater than left but wasn't for value " + value);
            assertTrue(layout.Compare(minimalSplitter, right) <= 0, "Expected right to be greater than or equal to minimal splitter but wasn't for value " + value);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void minimalSplitterShouldRemoveEntityIdIfPossible()
        internal virtual void MinimalSplitterShouldRemoveEntityIdIfPossible()
        {
            // Given
            StringLayout   layout          = new StringLayout();
            StringIndexKey left            = layout.NewKey();
            StringIndexKey right           = layout.NewKey();
            StringIndexKey minimalSplitter = layout.NewKey();

            string    @string    = _random.nextString();
            TextValue leftValue  = Values.stringValue(@string);
            TextValue rightValue = Values.stringValue(@string + _random.randomValues().nextCharRaw());

            // keys with unique values
            left.Initialize(1);
            left.initFromValue(0, leftValue, NEUTRAL);
            right.Initialize(2);
            right.initFromValue(0, rightValue, NEUTRAL);

            // When creating minimal splitter
            layout.MinimalSplitter(left, right, minimalSplitter);

            // Then that minimal splitter should have entity id shaved off
            assertEquals(NO_ENTITY_ID, minimalSplitter.EntityId, "Expected minimal splitter to have entityId removed when constructed from keys with unique values: " + "left=" + leftValue + ", right=" + rightValue);
        }