Skip to content

Commit

Permalink
Applied nullable annotations to ILGPU.Algorithms.Tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
MoFtZ committed Mar 3, 2023
1 parent 582630a commit 5b7a68c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Src/ILGPU.Algorithms.Tests/Generic/AlgorithmsTestData.tt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU Algorithms
// Copyright (c) 2021 ILGPU Project
// Copyright (c) 2021-2023 ILGPU Project
// www.ilgpu.net
//
// File: AlgorithmsTestData.tt/AlgorithmsTestData.cs
Expand All @@ -16,6 +16,7 @@

using ILGPU.Algorithms.RadixSortOperations;
using ILGPU.Algorithms.ScanReduceOperations;
using ILGPU.Util;
using System.Numerics;
using System.Runtime.CompilerServices;
using Xunit.Abstractions;
Expand All @@ -30,7 +31,10 @@ namespace ILGPU.Algorithms.Tests

public class AlgorithmsTestData<T> : IXunitSerializable
{
public AlgorithmsTestData() { }
public AlgorithmsTestData()
{
Value = Utilities.InitNotNullable<T>();
}

public AlgorithmsTestData(T value)
{
Expand All @@ -48,7 +52,7 @@ namespace ILGPU.Algorithms.Tests
info.AddValue(nameof(Value), Value);
}

public override string ToString() => Value.ToString();
public override string ToString() => $"{Value}";
}

#region Xunit Sequencer Structures
Expand Down
8 changes: 8 additions & 0 deletions Src/ILGPU.Algorithms.Tests/ILGPU.Algorithms.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>

<!-- Enable Nullable Reference Types, but only check for warnings on the latest framework -->
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' != '$(LibraryLatestUnitTestTargetFramework)'">
<NoWarn>$(NoWarn);nullable</NoWarn>
</PropertyGroup>

<PropertyGroup>
<RunSettingsFilePath>$(MSBuildProjectDirectory)\..\ILGPU.Tests\.test.runsettings</RunSettingsFilePath>
</PropertyGroup>
Expand Down

0 comments on commit 5b7a68c

Please sign in to comment.