Skip to content

Commit 831029a

Browse files
committed
Revert int Position back to uint Position
1 parent 282680a commit 831029a

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

BTDB.SourceGenerator.Test/BTDB.SourceGenerator.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.11.0"/>
1616
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0"/>
1717
<PackageReference Include="Verify.SourceGenerators" Version="2.5.0"/>
18-
<PackageReference Include="Verify.Xunit" Version="28.4.0"/>
18+
<PackageReference Include="Verify.Xunit" Version="28.8.1"/>
1919
<PackageReference Include="xunit" Version="2.9.2"/>
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
20+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
<PrivateAssets>all</PrivateAssets>
2323
</PackageReference>

BTDB/ODBLayer/IOrderedDictionary.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IOrderedDictionaryEnumerator<TKey, TValue> : IDisposable
1212
/// <returns>true if there was new key read</returns>
1313
bool NextKey(out TKey key);
1414

15-
int Position { get; set; }
15+
uint Position { get; set; }
1616
uint Count { get; }
1717
TValue CurrentValue { get; set; }
1818
}

BTDB/ODBLayer/ODBDictionary.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -740,19 +740,19 @@ public TValue CurrentValue
740740
}
741741
}
742742

743-
public int Position
743+
public uint Position
744744
{
745745
get
746746
{
747-
if (_cursor == null) return -1;
748-
return (int)(_ascending
747+
if (_cursor == null) return 0;
748+
return (uint)(_ascending
749749
? _cursor.GetKeyIndex() - _startCursor!.GetKeyIndex()
750750
: _endCursor!.GetKeyIndex() - _cursor.GetKeyIndex());
751751
}
752752

753753
set
754754
{
755-
if ((uint)value >= Count)
755+
if (value >= Count)
756756
{
757757
_cursor?.Dispose();
758758
_cursor = null;

BTDB/ODBLayer/RelationEnumerator.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1071,19 +1071,19 @@ public TValue CurrentValue
10711071
set => throw new NotSupportedException();
10721072
}
10731073

1074-
public int Position
1074+
public uint Position
10751075
{
10761076
get
10771077
{
10781078
if (_cursor == null) return 0;
1079-
return (int)(_ascending
1079+
return (uint)(_ascending
10801080
? _cursor.GetKeyIndex() - _startCursor!.GetKeyIndex()
10811081
: _endCursor!.GetKeyIndex() - _cursor.GetKeyIndex());
10821082
}
10831083

10841084
set
10851085
{
1086-
if ((uint)value >= Count) throw new IndexOutOfRangeException();
1086+
if (value >= Count) throw new IndexOutOfRangeException();
10871087
if (_ascending)
10881088
{
10891089
_cursor!.FindKeyIndex(_startCursor!.GetKeyIndex() + value);

BTDBTest/ObjectDBTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ public void AdvancedIterationBasics(int start, bool includeStart, int end, bool
23022302
}
23032303

23042304
Assert.Equal(result, res);
2305-
Assert.Equal(-1, (int)e.Position);
2305+
Assert.Equal(0, (int)e.Count);
23062306
param = new AdvancedEnumeratorParam<int>(EnumerationOrder.Descending, start,
23072307
start == -1
23082308
? KeyProposition.Ignored
@@ -2317,14 +2317,14 @@ public void AdvancedIterationBasics(int start, bool includeStart, int end, bool
23172317
Assert.Equal(result.Length, (int)e2.Count);
23182318
while (e2.NextKey(out key))
23192319
{
2320-
Assert.Equal(res.Length, e2.Position);
2320+
Assert.Equal(res.Length, (int)e2.Position);
23212321
var val = e2.CurrentValue;
23222322
Assert.Equal(key.ToString(CultureInfo.InvariantCulture), val);
23232323
res = val + res;
23242324
}
23252325

23262326
Assert.Equal(result, res);
2327-
Assert.Equal(-1, e2.Position);
2327+
Assert.Equal(0u, e2.Position);
23282328
}
23292329
}
23302330

@@ -2377,7 +2377,7 @@ public void AdvancedIterationSeeks(int start, bool includeStart, int end, bool i
23772377
e.Position = 2;
23782378
while (e.NextKey(out key))
23792379
{
2380-
Assert.Equal(res.Length, e.Position - 2);
2380+
Assert.Equal(res.Length, (int)e.Position - 2);
23812381
var val = e.CurrentValue;
23822382
Assert.Equal(key.ToString(CultureInfo.InvariantCulture), val);
23832383
res += val;

0 commit comments

Comments
 (0)