@@ -109,3 +109,51 @@ func TestNoZeroLeftovers(t *testing.T) {
109109 {Name : "s2" , Amount : big .NewInt (15 )},
110110 }, out )
111111}
112+
113+ func TestReconcileColoredAssetExactMatch (t * testing.T ) {
114+ stack := newFundsStack ([]Sender {
115+ {Name : "src" , Amount : big .NewInt (10 ), Color : "X" },
116+ {Name : "s2" , Amount : big .NewInt (15 )},
117+ })
118+
119+ out := stack .Pull (big .NewInt (10 ))
120+ require .Equal (t , []Sender {
121+ {Name : "src" , Amount : big .NewInt (10 ), Color : "X" },
122+ }, out )
123+
124+ }
125+
126+ func TestReconcileColoredManyDestPerSender (t * testing.T ) {
127+
128+ stack := newFundsStack ([]Sender {
129+ {"src" , big .NewInt (10 ), "X" },
130+ })
131+
132+ out := stack .Pull (big .NewInt (5 ))
133+ require .Equal (t , []Sender {
134+ {Name : "src" , Amount : big .NewInt (5 ), Color : "X" },
135+ }, out )
136+
137+ out = stack .Pull (big .NewInt (5 ))
138+ require .Equal (t , []Sender {
139+ {Name : "src" , Amount : big .NewInt (5 ), Color : "X" },
140+ }, out )
141+
142+ }
143+
144+ func TestReconcileColoredManySenderColors (t * testing.T ) {
145+ c1 := ("c1" )
146+ c2 := ("c2" )
147+
148+ stack := newFundsStack ([]Sender {
149+ {"src" , big .NewInt (1 ), c1 },
150+ {"src" , big .NewInt (1 ), c2 },
151+ })
152+
153+ out := stack .Pull (big .NewInt (2 ))
154+ require .Equal (t , []Sender {
155+ {Name : "src" , Amount : big .NewInt (1 ), Color : c1 },
156+ {Name : "src" , Amount : big .NewInt (1 ), Color : c2 },
157+ }, out )
158+
159+ }
0 commit comments