1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* User: alec |
4
|
|
|
* Date: 31.10.18 |
5
|
|
|
* Time: 16:33 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Unit; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
use AlecRabbit\DataOHLCV; |
12
|
|
|
use PHPUnit\Framework\TestCase; |
13
|
|
|
|
14
|
|
|
class DataOHLCVBasicTest extends TestCase |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @test |
18
|
|
|
* @dataProvider sizes |
19
|
|
|
* @param $expected |
20
|
|
|
* @param $actual |
21
|
|
|
*/ |
22
|
|
|
public function basicSize($expected, $actual): void |
23
|
|
|
{ |
24
|
|
|
$ohlcv = new DataOHLCV('btc_usd', $actual); |
25
|
|
|
$this->assertEquals($expected, $ohlcv->getSize()); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @test |
30
|
|
|
* @dataProvider pairs |
31
|
|
|
* @param $expected |
32
|
|
|
* @param $actual |
33
|
|
|
*/ |
34
|
|
|
public function basicPair($expected,$actual): void |
35
|
|
|
{ |
36
|
|
|
$ohlcv = new DataOHLCV($actual, 10); |
37
|
|
|
$this->assertEquals($expected, $ohlcv->getPair()); |
38
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function sizes(): array |
42
|
|
|
{ |
43
|
|
|
return [ |
44
|
|
|
[500, 500], |
45
|
|
|
[50, 50], |
46
|
|
|
[10, 0], |
47
|
|
|
[999,999], |
48
|
|
|
[1000, 1000], |
49
|
|
|
[1001, 1001], |
50
|
|
|
[1440, 1441], |
51
|
|
|
[1440, 10000], |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function pairs(): array |
56
|
|
|
{ |
57
|
|
|
return [ |
58
|
|
|
['btc_usd','btc_usd',], |
59
|
|
|
['btc_eur','btc_eur',], |
60
|
|
|
['btc_rur','btc_rur',], |
61
|
|
|
['ltc_btc','ltc_btc',], |
62
|
|
|
['ltc_usd','ltc_usd',], |
63
|
|
|
['ltc_rur','ltc_rur',], |
64
|
|
|
['nmc_btc','nmc_btc',], |
65
|
|
|
['usd_rur','usd_rur',], |
66
|
|
|
['eur_usd','eur_usd',], |
67
|
|
|
['nvc_btc','nvc_btc',], |
68
|
|
|
['ppc_btc','ppc_btc',], |
69
|
|
|
['ltc_eur','ltc_eur',], |
70
|
|
|
['nmc_usd','nmc_usd',], |
71
|
|
|
['nvc_usd','nvc_usd',], |
72
|
|
|
['ppc_usd','ppc_usd',], |
73
|
|
|
['eur_rur','eur_rur',], |
74
|
|
|
['dsh_btc','dsh_btc',], |
75
|
|
|
['dsh_usd','dsh_usd',], |
76
|
|
|
['eth_btc','eth_btc',], |
77
|
|
|
['eth_usd','eth_usd',], |
78
|
|
|
['eth_eur','eth_eur',], |
79
|
|
|
['eth_ltc','eth_ltc',], |
80
|
|
|
['eth_rur','eth_rur',], |
81
|
|
|
['dsh_rur','dsh_rur',], |
82
|
|
|
['dsh_eur','dsh_eur',], |
83
|
|
|
['dsh_ltc','dsh_ltc',], |
84
|
|
|
['dsh_eth','dsh_eth',], |
85
|
|
|
['bch_usd','bch_usd',], |
86
|
|
|
['bch_btc','bch_btc',], |
87
|
|
|
['bch_rur','bch_rur',], |
88
|
|
|
['bch_eur','bch_eur',], |
89
|
|
|
['bch_ltc','bch_ltc',], |
90
|
|
|
['bch_eth','bch_eth',], |
91
|
|
|
['bch_dsh','bch_dsh',], |
92
|
|
|
['zec_btc','zec_btc',], |
93
|
|
|
['zec_usd','zec_usd',], |
94
|
|
|
['usdet_usd','usdet_usd',], |
95
|
|
|
['ruret_rur','ruret_rur',], |
96
|
|
|
['euret_eur','euret_eur',], |
97
|
|
|
['btcet_btc','btcet_btc',], |
98
|
|
|
['ltcet_ltc','ltcet_ltc',], |
99
|
|
|
['ethet_eth','ethet_eth',], |
100
|
|
|
['nmcet_nmc','nmcet_nmc',], |
101
|
|
|
['nvcet_nvc','nvcet_nvc',], |
102
|
|
|
['ppcet_ppc','ppcet_ppc',], |
103
|
|
|
['dshet_dsh','dshet_dsh',], |
104
|
|
|
['bchet_bch','bchet_bch',], |
105
|
|
|
['dsh_zec','dsh_zec',], |
106
|
|
|
['eth_zec','eth_zec',], |
107
|
|
|
['bch_zec','bch_zec',], |
108
|
|
|
['zec_ltc','zec_ltc',], |
109
|
|
|
['usdt_usd','usdt_usd',], |
110
|
|
|
['btc_usdt','btc_usdt',], |
111
|
|
|
['xmr_usd','xmr_usd',], |
112
|
|
|
['xmr_btc','xmr_btc',], |
113
|
|
|
['xmr_eth','xmr_eth',], |
114
|
|
|
['xmr_rur','xmr_rur',], |
115
|
|
|
]; |
116
|
|
|
} |
117
|
|
|
} |