|
37 | 37 | balance INT NOT NULL)")])
|
38 | 38 | (doseq [a (:accounts test)]
|
39 | 39 | (info "Populating account")
|
40 |
| - (sql/insert! conn table-name {:id a |
41 |
| - :balance (if (= a (first (:accounts test))) |
42 |
| - (:total-amount test) |
43 |
| - 0)})))) |
| 40 | + ; Distribute initial balances uniformly. |
| 41 | + (let [initial-balance (/ (:total-amount test) |
| 42 | + (count (:accounts test)))] |
| 43 | + (sql/insert! conn table-name |
| 44 | + {:id a |
| 45 | + :balance initial-balance}))))) |
| 46 | + |
44 | 47 | (assoc this :conn conn :node node))))
|
45 | 48 |
|
46 | 49 | (invoke! [this test op]
|
|
91 | 94 | "account_id INT NOT NULL,"
|
92 | 95 | "balance INT NOT NULL)")])
|
93 | 96 | (info "Populating account" a)
|
94 |
| - (sql/insert! conn (str table-name a) |
95 |
| - {:id 0 |
96 |
| - :account_id a |
97 |
| - :balance 10}))))) |
| 97 | + ; Distribute initial balances uniformly. |
| 98 | + (let [initial-balance (/ (:total-amount test) |
| 99 | + (count (:accounts test)))] |
| 100 | + (sql/insert! conn (str table-name a) |
| 101 | + {:id 0 |
| 102 | + :account_id a |
| 103 | + :balance initial-balance})))))) |
| 104 | + |
98 | 105 | (assoc this :conn conn :node node))))
|
99 | 106 |
|
100 | 107 | (invoke! [this test op]
|
|
157 | 164 | balance INT NOT NULL)")])
|
158 | 165 | (doseq [a (:accounts test)]
|
159 | 166 | (info "Populating account")
|
160 |
| - (sql/insert! conn table-name {:id a |
161 |
| - :balance (if (= a (first (:accounts test))) |
162 |
| - (:total-amount test) |
163 |
| - 0)})))) |
| 167 | + ; Distribute initial balances uniformly. |
| 168 | + (let [initial-balance (/ (:total-amount test) |
| 169 | + (count (:accounts test)))] |
| 170 | + (sql/insert! conn table-name |
| 171 | + {:id a |
| 172 | + :balance initial-balance}))))) |
| 173 | + |
164 | 174 | (assoc this :conn conn :node node))))
|
165 | 175 |
|
166 | 176 | (invoke! [this test op]
|
|
220 | 230 | "(id INT NOT NULL PRIMARY KEY,"
|
221 | 231 | "balance INT NOT NULL)")])
|
222 | 232 | (info "Populating account" a)
|
223 |
| - (sql/insert! conn (str table-name a) |
224 |
| - {:id 0 |
225 |
| - :balance (if (= a (first (:accounts test))) |
226 |
| - (:total-amount test) |
227 |
| - 0)}))))) |
| 233 | + ; Distribute initial balances uniformly. |
| 234 | + (let [initial-balance (/ (:total-amount test) |
| 235 | + (count (:accounts test)))] |
| 236 | + (sql/insert! conn (str table-name a) |
| 237 | + {:id 0 |
| 238 | + :balance initial-balance})))))) |
| 239 | + |
228 | 240 | (assoc this :conn conn :node node))))
|
229 | 241 |
|
230 | 242 | (invoke! [this test op]
|
|
0 commit comments