31 lines
704 B
Go
31 lines
704 B
Go
|
package actions
|
||
|
|
||
|
import (
|
||
|
// "fmt"
|
||
|
"testing"
|
||
|
engine "github.com/tgckpg/mmqlengine/mmql/engine"
|
||
|
stmtd "github.com/tgckpg/mmqlengine/mmql/statements"
|
||
|
)
|
||
|
|
||
|
func TestBuyStatement( t *testing.T ) {
|
||
|
lexer := engine.Lexer{}
|
||
|
supportedStmts := map[string] func( *engine.Lexer ) ( stmtd.IStatement, error ) {
|
||
|
"BUY": BuyStatement,
|
||
|
"AMOUNT": AmountStatement,
|
||
|
}
|
||
|
lexer.SupportedStmts = &supportedStmts
|
||
|
|
||
|
_, err := lexer.Parse( `
|
||
|
BUY 1 SHARES OF BTC_ETF
|
||
|
FOR 10 USD
|
||
|
FROM "MyBrokerAccount"
|
||
|
WITH LIMIT OF PURCHASING_POWER( "MyBrokerAccount", "QQQ" )
|
||
|
FOR EVERY
|
||
|
1 BTC OF USD_BTC SOLD
|
||
|
FROM "CoinBase"
|
||
|
` )
|
||
|
if err != nil {
|
||
|
t.Error( err )
|
||
|
}
|
||
|
}
|