File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package bot
2+
3+ import "testing"
4+
5+ func Test_tempPriceStore_storePrice (t1 * testing.T ) {
6+ t := tempPriceStore {}
7+
8+ _ , exists := t .getPrice (1234 , "de" )
9+ if exists {
10+ t1 .Errorf ("Price shouldn't exist yet" )
11+ }
12+
13+ t .storePrice (1234 , "de" , 1.0 )
14+ if t .store [1234 ]["de" ] != 1.0 {
15+ t1 .Errorf ("tempPriceStore.storePrice() failed" )
16+ }
17+
18+ _ , exists2 := t .getPrice (1234 , "de" )
19+ if ! exists2 {
20+ t1 .Errorf ("Price must exist now!" )
21+ }
22+
23+ _ , exists3 := t .getPrice (1234 , "at" )
24+ if exists3 {
25+ t1 .Errorf ("Price shouldn't exist for other location!" )
26+ }
27+
28+ t .storePrice (1234 , "at" , 34.56 )
29+ if t .store [1234 ]["at" ] != 34.56 {
30+ t1 .Errorf ("tempPriceStore.storePrice() failed" )
31+ }
32+
33+ p , exists4 := t .getPrice (1234 , "at" )
34+ if ! exists4 || p != 34.56 {
35+ t1 .Errorf ("Price shouldn't exist for other location!" )
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments