-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathBenchmarks.ReferenceCounter.cs
55 lines (49 loc) · 1.58 KB
/
Benchmarks.ReferenceCounter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2015-2024 The Neo Project.
//
// Benchmarks.ReferenceCounter.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.
using BenchmarkDotNet.Attributes;
using Neo.Test;
using Neo.Test.Extensions;
using Neo.Test.Types;
using System.Text;
namespace Neo.VM.Benchmark
{
public class Benchmarks_ReferenceCounter : VMJsonTestBase
{
[Benchmark]
public void V2()
{
Run<ReferenceCounterV2>();
}
[Benchmark]
public void V1()
{
Run<ReferenceCounter>();
}
private void Run<T>() where T : IReferenceCounter, new()
{
var path = Path.GetFullPath("../../../../../../../../../tests/Neo.VM.Tests/Tests");
foreach (var file in Directory.GetFiles(path, "*.json", SearchOption.AllDirectories))
{
var realFile = Path.GetFullPath(file);
var json = File.ReadAllText(realFile, Encoding.UTF8);
var ut = json.DeserializeJson<VMUT>();
try
{
ExecuteTest<T>(ut);
}
catch (Exception ex)
{
throw new AggregateException("Error in file: " + realFile, ex);
}
}
}
}
}