Skip to content

Commit 82e34f0

Browse files
committed
fix exponent usage in test_twap
1 parent 257cd71 commit 82e34f0

File tree

4 files changed

+167
-163
lines changed

4 files changed

+167
-163
lines changed

pctest/test_twap.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int main( int argc,char** argv )
8080
px->agg_.pub_slot_ = slot;
8181
px->num_ = 0;
8282
upd_aggregate( px, slot+1 );
83-
pc_qset_t *qs = qset_new( px->expo_ );
83+
pc_qset_t *qs = nullptr;
8484

8585
// skip first line
8686
csv_parser cp( mf.data(), mf.size( ));
@@ -96,6 +96,10 @@ int main( int argc,char** argv )
9696
px->expo_ = expo;
9797
px->agg_.price_ = price;
9898
px->agg_.conf_ = conf;
99+
if ( ! qs ) {
100+
px->expo_ = expo;
101+
qs = qset_new( px->expo_ );
102+
}
99103
upd_twap( px, nslots, qs );
100104
std::cout << price << ','
101105
<< conf << ','

pyth/tests/test_twap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def _get_test_class():
1212

1313
test_folder = os.path.join(_this_dir, 'twap')
1414

15-
class TestQset(object):
15+
class TestTwap(object):
1616

1717
def run_test(self, test_id):
1818
test_file = os.path.join(test_folder, '%s.csv' % (test_id,))
@@ -32,9 +32,9 @@ def test_func(self):
3232
self.run_test(test_id)
3333
return test_func
3434

35-
setattr(TestQset, 'test_%s' % (test_id,), get_test_func(test_id))
35+
setattr(TestTwap, 'test_%s' % (test_id,), get_test_func(test_id))
3636

37-
return TestQset
37+
return TestTwap
3838

3939

40-
TestQset = _get_test_class()
40+
TestTwap = _get_test_class()

pyth/tests/twap/1.result

100755100644
File mode changed.
Lines changed: 158 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,159 @@
11
price,conf,expo,nslots,twap,twac
2-
123456789,1,-4,5000,12345,0
3-
123456789,1,-4,1,12345,0
4-
123456789,1,-4,1,12345,0
5-
123456789,1,-4,1,12345,0
6-
123456789,1,-4,1,12345,0
7-
123456789,1,-4,1,12345,0
8-
123456789,1,-4,1,12345,0
9-
123456789,1,-4,1,12345,0
10-
123456789,1,-4,1,12345,0
11-
123456789,1,-4,1,12345,0
12-
123456789,1,-4,1,12345,0
13-
123456789,1,-4,1,12345,0
14-
123456789,1,-4,1,12345,0
15-
123456789,1,-4,1,12345,0
16-
123456789,1,-4,1,12345,0
17-
123456789,1,-4,1,12345,0
18-
123456789,1,-4,1,12345,0
19-
123456789,1,-4,1,12345,0
20-
123456789,1,-4,1,12345,0
21-
123456789,1,-4,1,12345,0
22-
123456789,1,-4,1,12345,0
23-
123456789,1,-4,1,12345,0
24-
123456789,1,-4,1,12345,0
25-
123456789,1,-4,1,12345,0
26-
123456789,1,-4,1,12345,0
27-
123456789,1,-4,1,12345,0
28-
123456789,1,-4,1,12345,0
29-
123456789,1,-4,1,12345,0
30-
123456789,1,-4,1,12345,0
31-
123456789,1,-4,1,12345,0
32-
123456789,1,-4,1,12345,0
33-
123456789,1,-4,1,12345,0
34-
123456789,1,-4,1,12345,0
35-
123456789,1,-4,1,12345,0
36-
123456789,1,-4,1,12345,0
37-
123456789,1,-4,1,12345,0
38-
123456789,1,-4,1,12345,0
39-
123456789,1,-4,1,12345,0
40-
123456789,1,-4,1,12345,0
41-
123456789,1,-4,1,12345,0
42-
123456789,1,-4,1,12345,0
43-
123456789,1,-4,1,12345,0
44-
123456789,1,-4,1,12345,0
45-
123456789,1,-4,1,12345,0
46-
123456789,1,-4,1,12345,0
47-
123456789,1,-4,1,12345,0
48-
123456789,1,-4,1,12345,0
49-
123456789,1,-4,1,12345,0
50-
123456789,1,-4,1,12345,0
51-
123456789,1,-4,1,12345,0
52-
123456789,1,-4,1,12345,0
53-
123456789,1,-4,1,12345,0
54-
123456789,1,-4,1,12345,0
55-
123456789,1,-4,1,12345,0
56-
123456789,1,-4,1,12345,0
57-
123456789,1,-4,1,12345,0
58-
123456789,1,-4,1,12345,0
59-
123456789,1,-4,1,12345,0
60-
123456789,1,-4,1,12345,0
61-
123456789,1,-4,1,12345,0
62-
123456789,1,-4,1,12345,0
63-
123456789,1,-4,1,12345,0
64-
123456789,1,-4,1,12345,0
65-
123456789,1,-4,1,12345,0
66-
123456789,1,-4,1,12345,0
67-
123456789,1,-4,1,12345,0
68-
123456789,1,-4,1,12345,0
69-
123456789,1,-4,1,12345,0
70-
123456789,1,-4,1,12345,0
71-
123456789,1,-4,1,12345,0
72-
123456789,1,-4,1,12345,0
73-
123456789,1,-4,1,12345,0
74-
123456789,1,-4,1,12345,0
75-
123456789,1,-4,1,12345,0
76-
123456789,1,-4,1,12345,0
77-
123456789,1,-4,1,12345,0
78-
123456789,1,-4,1,12345,0
79-
123456789,1,-4,1,12345,0
80-
123456789,1,-4,1,12345,0
81-
123456789,1,-4,1,12345,0
82-
123456789,1,-4,1,12345,0
83-
123456789,1,-4,1,12345,0
84-
123456789,1,-4,1,12345,0
85-
123456789,1,-4,1,12345,0
86-
123456789,1,-4,1,12345,0
87-
123456789,1,-4,1,12345,0
88-
123456789,1,-4,1,12345,0
89-
123456789,1,-4,1,12345,0
90-
123456789,1,-4,1,12345,0
91-
123456789,1,-4,1,12345,0
92-
123456789,1,-4,1,12345,0
93-
123456789,1,-4,1,12345,0
94-
123456789,1,-4,1,12345,0
95-
123456789,1,-4,1,12345,0
96-
123456789,1,-4,1,12345,0
97-
123456789,1,-4,1,12345,0
98-
123456789,1,-4,1,12345,0
99-
123456789,1,-4,1,12345,0
100-
123456789,1,-4,1,12345,0
101-
123456789,1,-4,1,12345,0
102-
123456789,1,-4,1,12345,0
103-
123456789,1,-4,1,12345,0
104-
123456789,1,-4,1,12345,0
105-
123456789,1,-4,1,12345,0
106-
123456789,1,-4,1,12345,0
107-
123456789,1,-4,1,12345,0
108-
123456789,1,-4,1,12345,0
109-
123456789,1,-4,1,12345,0
110-
123456789,1,-4,1,12345,0
111-
123456789,1,-4,1,12345,0
112-
123456789,1,-4,1,12345,0
113-
123456789,1,-4,1,12345,0
114-
123456789,1,-4,1,12345,0
115-
123456789,1,-4,1,12345,0
116-
123456789,1,-4,1,12345,0
117-
123456789,1,-4,1,12345,0
118-
123456789,1,-4,1,12345,0
119-
123456789,1,-4,1,12345,0
120-
123456789,1,-4,1,12345,0
121-
123456789,1,-4,1,12345,0
122-
123456789,1,-4,1,12345,0
123-
123456789,1,-4,1,12345,0
124-
123456789,1,-4,1,12345,0
125-
123456789,1,-4,1,12345,0
126-
123456789,1,-4,1,12345,0
127-
123456789,1,-4,1,12345,0
128-
123456789,1,-4,1,12345,0
129-
123456789,1,-4,1,12345,0
130-
123456789,1,-4,1,12345,0
131-
123456789,1,-4,1,12345,0
132-
123456789,1,-4,1,12345,0
133-
123456789,1,-4,1,12345,0
134-
123456789,1,-4,1,12345,0
135-
123456789,1,-4,1,12345,0
136-
123456789,1,-4,1,12345,0
137-
123456789,1,-4,1,12345,0
138-
123456789,1,-4,1,12345,0
139-
123456789,1,-4,1,12345,0
140-
123456789,1,-4,1,12345,0
141-
123456789,1,-4,1,12345,0
142-
123456789,1,-4,1,12345,0
143-
123456789,1,-4,1,12345,0
144-
123456789,1,-4,1,12345,0
145-
123456789,1,-4,1,12345,0
146-
123456789,1,-4,1,12345,0
147-
123456789,1,-4,1,12345,0
148-
123456789,1,-4,1,12345,0
149-
123456789,1,-4,1,12345,0
150-
123456789,1,-4,1,12345,0
151-
123456789,1,-4,1,12345,0
152-
123456789,1,-4,1,12345,0
153-
123456789,1,-4,1,12345,0
154-
123456789,1,-4,1,12345,0
155-
123456789,1,-4,1,12345,0
156-
123456789,1,-4,1,12345,0
157-
123456789,1,-4,1,12345,0
158-
123456789,1,-4,1,12345,0
159-
123456789,1,-4,1,12345,0
2+
123456789,1,-4,5000,123456789,1
3+
123456789,1,-4,1,123456788,1
4+
123456789,1,-4,1,123456786,1
5+
123456789,1,-4,1,123456784,1
6+
123456789,1,-4,1,123456781,1
7+
123456789,1,-4,1,123456782,1
8+
123456789,1,-4,1,123456783,1
9+
123456789,1,-4,1,123456783,1
10+
123456789,1,-4,1,123456783,1
11+
123456789,1,-4,1,123456783,1
12+
123456789,1,-4,1,123456782,1
13+
123456789,1,-4,1,123456782,1
14+
123456789,1,-4,1,123456782,1
15+
123456789,1,-4,1,123456782,1
16+
123456789,1,-4,1,123456783,1
17+
123456789,1,-4,1,123456783,1
18+
123456789,1,-4,1,123456783,1
19+
123456789,1,-4,1,123456783,1
20+
123456789,1,-4,1,123456783,1
21+
123456789,1,-4,1,123456783,1
22+
123456789,1,-4,1,123456782,1
23+
123456789,1,-4,1,123456780,1
24+
123456789,1,-4,1,123456776,1
25+
123456789,1,-4,1,123456773,1
26+
123456789,1,-4,1,123456766,1
27+
123456789,1,-4,1,123456761,1
28+
123456789,1,-4,1,123456758,1
29+
123456789,1,-4,1,123456757,1
30+
123456789,1,-4,1,123456755,1
31+
123456789,1,-4,1,123456753,1
32+
123456789,1,-4,1,123456754,1
33+
123456789,1,-4,1,123456751,1
34+
123456789,1,-4,1,123456751,1
35+
123456789,1,-4,1,123456751,1
36+
123456789,1,-4,1,123456750,1
37+
123456789,1,-4,1,123456749,1
38+
123456789,1,-4,1,123456747,1
39+
123456789,1,-4,1,123456746,1
40+
123456789,1,-4,1,123456746,1
41+
123456789,1,-4,1,123456744,1
42+
123456789,1,-4,1,123456743,1
43+
123456789,1,-4,1,123456743,1
44+
123456789,1,-4,1,123456744,1
45+
123456789,1,-4,1,123456743,1
46+
123456789,1,-4,1,123456743,1
47+
123456789,1,-4,1,123456741,1
48+
123456789,1,-4,1,123456742,1
49+
123456789,1,-4,1,123456742,1
50+
123456789,1,-4,1,123456740,1
51+
123456789,1,-4,1,123456739,1
52+
123456789,1,-4,1,123456739,1
53+
123456789,1,-4,1,123456739,1
54+
123456789,1,-4,1,123456738,1
55+
123456789,1,-4,1,123456738,1
56+
123456789,1,-4,1,123456738,1
57+
123456789,1,-4,1,123456737,1
58+
123456789,1,-4,1,123456736,1
59+
123456789,1,-4,1,123456736,1
60+
123456789,1,-4,1,123456736,1
61+
123456789,1,-4,1,123456735,1
62+
123456789,1,-4,1,123456734,1
63+
123456789,1,-4,1,123456735,1
64+
123456789,1,-4,1,123456735,1
65+
123456789,1,-4,1,123456734,1
66+
123456789,1,-4,1,123456734,1
67+
123456789,1,-4,1,123456734,1
68+
123456789,1,-4,1,123456734,1
69+
123456789,1,-4,1,123456734,1
70+
123456789,1,-4,1,123456733,1
71+
123456789,1,-4,1,123456732,1
72+
123456789,1,-4,1,123456731,1
73+
123456789,1,-4,1,123456732,1
74+
123456789,1,-4,1,123456732,1
75+
123456789,1,-4,1,123456732,1
76+
123456789,1,-4,1,123456732,1
77+
123456789,1,-4,1,123456733,1
78+
123456789,1,-4,1,123456732,1
79+
123456789,1,-4,1,123456732,1
80+
123456789,1,-4,1,123456732,1
81+
123456789,1,-4,1,123456733,1
82+
123456789,1,-4,1,123456732,1
83+
123456789,1,-4,1,123456732,1
84+
123456789,1,-4,1,123456732,1
85+
123456789,1,-4,1,123456732,1
86+
123456789,1,-4,1,123456733,1
87+
123456789,1,-4,1,123456733,1
88+
123456789,1,-4,1,123456733,1
89+
123456789,1,-4,1,123456732,1
90+
123456789,1,-4,1,123456731,1
91+
123456789,1,-4,1,123456730,1
92+
123456789,1,-4,1,123456729,1
93+
123456789,1,-4,1,123456729,1
94+
123456789,1,-4,1,123456728,1
95+
123456789,1,-4,1,123456729,1
96+
123456789,1,-4,1,123456728,1
97+
123456789,1,-4,1,123456727,1
98+
123456789,1,-4,1,123456726,1
99+
123456789,1,-4,1,123456727,1
100+
123456789,1,-4,1,123456727,1
101+
123456789,1,-4,1,123456727,1
102+
123456789,1,-4,1,123456727,1
103+
123456789,1,-4,1,123456727,1
104+
123456789,1,-4,1,123456726,1
105+
123456789,1,-4,1,123456726,1
106+
123456789,1,-4,1,123456726,1
107+
123456789,1,-4,1,123456726,1
108+
123456789,1,-4,1,123456726,1
109+
123456789,1,-4,1,123456726,1
110+
123456789,1,-4,1,123456726,1
111+
123456789,1,-4,1,123456726,1
112+
123456789,1,-4,1,123456726,1
113+
123456789,1,-4,1,123456725,1
114+
123456789,1,-4,1,123456726,1
115+
123456789,1,-4,1,123456726,1
116+
123456789,1,-4,1,123456726,1
117+
123456789,1,-4,1,123456726,1
118+
123456789,1,-4,1,123456726,1
119+
123456789,1,-4,1,123456726,1
120+
123456789,1,-4,1,123456726,1
121+
123456789,1,-4,1,123456727,1
122+
123456789,1,-4,1,123456726,1
123+
123456789,1,-4,1,123456726,1
124+
123456789,1,-4,1,123456726,1
125+
123456789,1,-4,1,123456726,1
126+
123456789,1,-4,1,123456726,1
127+
123456789,1,-4,1,123456726,1
128+
123456789,1,-4,1,123456726,1
129+
123456789,1,-4,1,123456726,1
130+
123456789,1,-4,1,123456726,1
131+
123456789,1,-4,1,123456726,1
132+
123456789,1,-4,1,123456726,1
133+
123456789,1,-4,1,123456726,1
134+
123456789,1,-4,1,123456726,1
135+
123456789,1,-4,1,123456726,1
136+
123456789,1,-4,1,123456725,1
137+
123456789,1,-4,1,123456725,1
138+
123456789,1,-4,1,123456725,1
139+
123456789,1,-4,1,123456726,1
140+
123456789,1,-4,1,123456725,1
141+
123456789,1,-4,1,123456724,1
142+
123456789,1,-4,1,123456725,1
143+
123456789,1,-4,1,123456725,1
144+
123456789,1,-4,1,123456725,1
145+
123456789,1,-4,1,123456725,1
146+
123456789,1,-4,1,123456724,1
147+
123456789,1,-4,1,123456723,1
148+
123456789,1,-4,1,123456723,1
149+
123456789,1,-4,1,123456723,1
150+
123456789,1,-4,1,123456723,1
151+
123456789,1,-4,1,123456724,1
152+
123456789,1,-4,1,123456724,1
153+
123456789,1,-4,1,123456724,1
154+
123456789,1,-4,1,123456724,1
155+
123456789,1,-4,1,123456724,1
156+
123456789,1,-4,1,123456725,1
157+
123456789,1,-4,1,123456725,1
158+
123456789,1,-4,1,123456725,1
159+
123456789,1,-4,1,123456725,1

0 commit comments

Comments
 (0)