Skip to content

Commit

Permalink
Closed #1 - full set of orginal unit tests now working.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkromberg committed May 6, 2018
1 parent 25784bf commit ae628c8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Qtests.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ til 10,⍳10,Int64 List
`a`b`c!(1 2;3 5;7 11),"(,¨'abc')⍪⍉↑(1 2)(3 5)(7 11)",Dictionary
flip `a`b`c!(1 2;3 5;7 11),"(,¨'abc')⍪⍉↑(1 2)(3 5)(7 11)",Table
select from p where weight=17,(ptable[;3]∊'weight' 17)⌿ptable,Keyed Table
"select from trade where date=last date, sym=`AMD",tradeq1,Table
"select from trade where sym=`AMD",(trade[;2]∊'sym' 'AMD')⌿trade,Table
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# qconnect

An interface from Dyalog APL to Q. To use it, start q specifying
a port to listen on:
a port to listen on and, if you want to run the unit tests, loading th UTtest.q script:
```
q -p 5000
q qconnect\UTtest.q -p 5000
```
Then from APL (replacing "qconnect" below with folder name which
you have cloned or unzipped this repository to):
Expand All @@ -12,9 +12,8 @@ you have cloned or unzipped this repository to):
)copy conga DRC
q←⎕NEW Q ('127.0.0.1' 5000 'user')
q.x 'sum til 10'
⍝ Now run unit tests (some will fail due to missing tables)
Qtests←⎕CSV 'qconnect/QTests.csv'
]load qconnect/UT
UT 0
```
Prerequisites: Only tested with version 16.0, but should work with Dyalog version 13.1 or later. The use of ⎕CSV above requires Dyalog version 15.0 or later.
Prerequisites: Only tested with Dyalog versions 16.0 & 17.0, but should work with Dyalog version 13.1 or later. The use of ⎕CSV above requires Dyalog version 15.0 or later.
11 changes: 7 additions & 4 deletions UT.dyalog
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
failedUT debug;q;⎕IO;shouldbe;name;aplx;qx;OK;start;expected;got
failedUT debug;q;⎕IO;shouldbe;name;aplx;qx;OK;start;expected;got;trade;ptable
if debug = 1, stop on error

⎕IO0
:If 0=⎕NC'DRC' 'DRC'⎕CY'conga.dws' :EndIf Make sure conga client is here

start2⎕AI
q⎕NEW Q('127.0.0.1' 5000 'mkrom') Connect to Q
{}q.x'\l sp.q' Load Suppliers and Parts
:Trap 11 Will fail if TAQ already loaded
{}q.x'\l db/taq' Load Trades and Quotes

:Trap 0
ptableq.x'p'
tradeq.x'trade'
:Else
'Unable to load p and trade - did you run UTdata.q?'⎕SIGNAL 11
:EndTrap

failed
Expand Down
12 changes: 12 additions & 0 deletions UTdata.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
p:([p:`p1`p2`p3`p4`p5`p6]
name:`nut`bolt`screw`screw`cam`cog;
color:`red`green`blue`red`blue`red;
weight:12 17 17 14 12 19;
city:`london`paris`rome`london`paris`london);

trade:asc([]date:10?.z.d;
time:10?.z.t;
sym:10?`AMD`AAPL`GOOG;
price:10?1000f;
size:10?100;
ex:10?"AB")

0 comments on commit ae628c8

Please sign in to comment.