Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions LibLouis.NET.Test/InputLengthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void Translate_DoesNotWriteOutputPositionsPastInputLength()
Input,
outputLength,
null,
null,
outputPosition,
new int[outputLength],
0,
Expand All @@ -74,7 +73,7 @@ public void Translate_DoesNotTranslateTheNulTerminator()
const string input = "abc";

string translated = LibLouis.Instance.Translate(
TablePaths(), input, input.Length * 4, null, null, TranslationMode.Regular);
TablePaths(), input, input.Length * 4, null, TranslationMode.Regular);

Assert.DoesNotContain('\0', translated);
Assert.Equal(input, translated);
Expand Down
2 changes: 1 addition & 1 deletion LibLouis.NET.Test/LiblouisHeapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
nint module = NativeLibrary.Load("liblouis", typeof(LibLouis).Assembly, DllImportSearchPath.SafeDirectories);
nint free = LiblouisHeap.FindImport((byte*)module, "free"u8);

nint[] runtimeFrees = [.. new[] { "msvcrt.dll", "ucrtbase.dll" }

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / managed packages

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / managed packages

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / managed packages

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)

Check warning on line 126 in LibLouis.NET.Test/LiblouisHeapTests.cs

View workflow job for this annotation

GitHub Actions / managed packages

Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)
.Select(name => NativeLibrary.TryLoad(name, out nint runtime) ? NativeLibrary.GetExport(runtime, "free") : 0)];

Assert.NotEqual(0, free);
Expand All @@ -147,7 +147,7 @@
Assert.NotNull(table);
Assert.EndsWith("da-dk-g26.ctb", table, StringComparison.Ordinal);

Assert.NotEmpty(LibLouis.Instance.Translate(TablePaths(), "F酶rste linje", 64, null, null, TranslationMode.Regular));
Assert.NotEmpty(LibLouis.Instance.Translate(TablePaths(), "F酶rste linje", 64, null, TranslationMode.Regular));
}
}
}
2 changes: 1 addition & 1 deletion LibLouis.NET.Test/LogCallbackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Logger_StillReceivesMessagesAfterGarbageCollection()
// Any failing call makes liblouis log; a table that cannot be compiled is the simplest.
Assert.Throws<LibLouisException>(
() => LibLouis.Instance.Translate(
["no-such-table-at-all.ctb"], "x", 8, null, null, TranslationMode.Regular));
["no-such-table-at-all.ctb"], "x", 8, null, TranslationMode.Regular));

Assert.NotEmpty(logger.Messages);
}
Expand Down
2 changes: 1 addition & 1 deletion LibLouis.NET.Test/NativeLockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ .. Enumerable.Range(0, 4).Select(_ => Task.Run(() =>
while (!cts.IsCancellationRequested)
{
string result = LibLouis.Instance.Translate(
TablePaths(), input, 64, null, null, TranslationMode.Regular);
TablePaths(), input, 64, null, TranslationMode.Regular);

if (result != expected)
{
Expand Down
5 changes: 1 addition & 4 deletions LibLouis.NET.Test/NativeMethodsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void SingleMode()
input,
outputLength,
modes,
null,
TranslationMode.Regular);

Assert.Equal("`,@this is a test.`,", resultString);
Expand All @@ -52,7 +51,6 @@ public void NestedMode_EmphasisInForeignLanguage()
input,
outputLength,
modes,
null,
TranslationMode.Regular);

Assert.Equal("`,@this \\is\\ a test.`,", resultString);
Expand Down Expand Up @@ -93,7 +91,6 @@ public void NestedMode_ForeignLanguageInEmphasis()
input,
outputLength,
modes,
null,
TranslationMode.Regular);

Assert.Equal("\\@han sagde `,yes`,.\\", resultString);
Expand All @@ -112,7 +109,7 @@ public void TestPositionResults()
int[] inputPosition = new int[outputLength];
int[] outputPosition = new int[input.Length];

TranslatedString translated = LibLouis.Instance.Translate(tables, input, outputLength, null, null, outputPosition, inputPosition, cursorPosition, TranslationMode.Regular);
TranslatedString translated = LibLouis.Instance.Translate(tables, input, outputLength, null, outputPosition, inputPosition, cursorPosition, TranslationMode.Regular);

Assert.Equal(expected, translated.Output);

Expand Down
3 changes: 0 additions & 3 deletions LibLouis.NET.Test/OutputDotsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private static TranslatedString TranslateWithTypeForm(string input)
input,
input.Length * 4,
typeform,
null,
new int[input.Length],
new int[input.Length * 4],
0,
Expand Down Expand Up @@ -65,7 +64,6 @@ public void IsNullWhenNoTypeFormWasPassed()
"Abc",
16,
null,
null,
new int[3],
new int[16],
0,
Expand All @@ -89,7 +87,6 @@ public void CallersArrayStaysUntouched()
"Abc",
16,
typeform,
null,
new int[3],
new int[16],
0,
Expand Down
7 changes: 1 addition & 6 deletions LibLouis.NET.Test/PositionMappingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ private static TranslatedString Translate(string input)
input,
outputLength,
null,
null,
new int[input.Length],
new int[outputLength],
0,
Expand Down Expand Up @@ -131,7 +130,7 @@ public void BmpTextIsUnchanged()
int[] scratchInput = new int[outputLength];

TranslatedString result = LibLouis.Instance.Translate(
TablePaths(), input, outputLength, null, null, scratchOutput, scratchInput, 0, TranslationMode.Regular);
TablePaths(), input, outputLength, null, scratchOutput, scratchInput, 0, TranslationMode.Regular);

Assert.Equal(scratchOutput, result.OutputPosition);
Assert.Equal(scratchInput[..result.Output.Length], result.InputPosition);
Expand Down Expand Up @@ -169,7 +168,6 @@ public void CursorPositionIsAnIndexIntoTheOutput()
input,
outputLength,
null,
null,
new int[input.Length],
new int[outputLength],
input.IndexOf('b', StringComparison.Ordinal),
Expand All @@ -196,7 +194,6 @@ public void CursorAtEndOfInputStaysAtEndOfOutput(string input)
input,
outputLength,
null,
null,
new int[input.Length],
new int[outputLength],
input.Length,
Expand All @@ -219,7 +216,6 @@ public void BackTranslateCursorAtEndOfInputStaysAtEndOfOutput()
braille,
outputLength,
null,
null,
new int[braille.Length],
new int[outputLength],
braille.Length,
Expand All @@ -243,7 +239,6 @@ public void CursorOnLastCharacterStaysOnIt()
input,
outputLength,
null,
null,
new int[input.Length],
new int[outputLength],
input.Length - 1,
Expand Down
6 changes: 3 additions & 3 deletions LibLouis.NET.Test/ShutdownTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public void UsingTheInstanceAfterShutdownThrows()
WhileMarkedShutDown(() =>
{
Assert.Throws<InvalidOperationException>(
() => LibLouis.Instance.Translate(TablePaths(), "abc", 16, null, null, TranslationMode.Regular));
() => LibLouis.Instance.Translate(TablePaths(), "abc", 16, null, TranslationMode.Regular));

Assert.Throws<InvalidOperationException>(
() => LibLouis.Instance.Translate(
TablePaths(), "abc", 16, null, null, new int[16], new int[16], 0, TranslationMode.Regular));
TablePaths(), "abc", 16, null, new int[16], new int[16], 0, TranslationMode.Regular));

Assert.Throws<InvalidOperationException>(
() => LibLouis.Instance.BackTranslate(TablePaths(), "abc", 16, null, null, TranslationMode.Regular));
() => LibLouis.Instance.BackTranslate(TablePaths(), "abc", 16, null, TranslationMode.Regular));

Assert.Throws<InvalidOperationException>(
() => LibLouis.Instance.CharactersToDots(TablePaths(), "abc"));
Expand Down
Loading
Loading