Browse Source

Upgrade unittest target framework to .net8

tags/0.9.1
xbotter 1 year ago
parent
commit
df66d7e0c6
No known key found for this signature in database GPG Key ID: A3F32F44E9F160E1
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      LLama.Unittest/LLama.Unittest.csproj
  2. +5
    -2
      LLama.Unittest/ModelsParamsTests.cs

+ 2
- 2
LLama.Unittest/LLama.Unittest.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\LLama\LLamaSharp.Runtime.targets" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>LLama.Unittest</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x64</Platforms>


+ 5
- 2
LLama.Unittest/ModelsParamsTests.cs View File

@@ -1,4 +1,5 @@
using LLama.Common;
using System.Text.Json;

namespace LLama.Unittest
{
@@ -7,6 +8,8 @@ namespace LLama.Unittest
[Fact]
public void SerializeRoundTripSystemTextJson()
{
var options = new JsonSerializerOptions();
options.Converters.Add(new EncodingConverter());
var expected = new ModelParams("abc/123")
{
BatchSize = 17,
@@ -16,8 +19,8 @@ namespace LLama.Unittest
TensorSplits = { [0] = 3 }
};

var json = System.Text.Json.JsonSerializer.Serialize(expected);
var actual = System.Text.Json.JsonSerializer.Deserialize<ModelParams>(json)!;
var json = JsonSerializer.Serialize(expected, options);
var actual = JsonSerializer.Deserialize<ModelParams>(json, options)!;

// Cannot compare splits with default equality, check they are sequence equal and then set to null
Assert.Equal((IEnumerable<float>)expected.TensorSplits, expected.TensorSplits);


Loading…
Cancel
Save