forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumeric.cs
More file actions
67 lines (59 loc) · 1.93 KB
/
Numeric.cs
File metadata and controls
67 lines (59 loc) · 1.93 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using Npgsql.TypeHandlers.NumericHandlers;
namespace Npgsql.Benchmarks.TypeHandlers
{
[Config(typeof(Config))]
public class Int16 : TypeHandlerBenchmarks<short>
{
public Int16() : base(new Int16Handler(GetPostgresType("smallint"))) { }
}
[Config(typeof(Config))]
public class Int32 : TypeHandlerBenchmarks<int>
{
public Int32() : base(new Int32Handler(GetPostgresType("integer"))) { }
}
[Config(typeof(Config))]
public class Int64 : TypeHandlerBenchmarks<long>
{
public Int64() : base(new Int64Handler(GetPostgresType("bigint"))) { }
}
[Config(typeof(Config))]
public class Single : TypeHandlerBenchmarks<float>
{
public Single() : base(new SingleHandler(GetPostgresType("real"))) { }
}
[Config(typeof(Config))]
public class Double : TypeHandlerBenchmarks<double>
{
public Double() : base(new DoubleHandler(GetPostgresType("double precision"))) { }
}
[Config(typeof(Config))]
public class Numeric : TypeHandlerBenchmarks<decimal>
{
public Numeric() : base(new NumericHandler(GetPostgresType("numeric"))) { }
protected override IEnumerable<decimal> ValuesOverride() => new[]
{
0.0000000000000000000000000001M,
0.000000000000000000000001M,
0.00000000000000000001M,
0.0000000000000001M,
0.000000000001M,
0.00000001M,
0.0001M,
1M,
10000M,
100000000M,
1000000000000M,
10000000000000000M,
100000000000000000000M,
1000000000000000000000000M,
10000000000000000000000000000M,
};
}
[Config(typeof(Config))]
public class Money : TypeHandlerBenchmarks<decimal>
{
public Money() : base(new MoneyHandler(GetPostgresType("money"))) { }
}
}