Browse files

First commit for this project

  • Loading branch information...
0 parents commit 101b0c402a2462c7e7b2a2330bf10bcb42cb212d gianfranco committed Apr 29, 2012
Showing with 60 additions and 0 deletions.
  1. +19 −0 Booking/booking.dyalog
  2. +38 −0 Booking/booking_unittests.dyalog
  3. +3 −0 Booking/workcycle.txt
19 Booking/booking.dyalog
@@ -0,0 +1,19 @@
+:Namespace Booking
+
+GETName { Lookup ,1 }
+GETID { Lookup ,2 }
+
+ Z Lookup Input;LookupTable;Col;Key
+ (LookupTable Key Col) Input
+ Z LookupTable[LookupTable[;Col] Key;1+2|Col]
+
+
+ Z Book Input;Table;Bookings;BookingId;Rows;Slots
+ (Table Bookings BookingId) Input
+ Rows Table[;1] ¨Bookings
+ Slots 1¨Bookings
+ {Table[1;1+1] BookingId} ¨ Rows,¨Slots
+ ZTable
+
+
+:EndNamespace
38 Booking/booking_unittests.dyalog
@@ -0,0 +1,38 @@
+:Namespace Booking_UT
+
+UTNameTable (1 'a') (2 'b') (3 'c')
+UTTable (3 0 0 0) (1 0 0 0) (2 0 0 0)
+
+ Z UT1
+ Z 'a' #.Booking.GETName UTNameTable 1
+
+
+ Z UT2
+ Z 3 #.Booking.GETID UTNameTable 'c'
+
+
+ Z UT3;BookingSlots;BookingId;Expected
+ BookingSlots (1 2 3) (3 1) (2 1 3)
+ BookingId 5
+ Expected (3 5 0 0) (1 0 5 5) (2 5 0 5)
+ Z Expected #.Booking.Book UTTable BookingSlots BookingId
+
+
+ Z RunTest Name
+ Z Name
+ :If ~ Z
+ '-------------------------'
+ 'Unit test ',Name,' failed'
+ vr Name
+ :Endif
+
+
+ Z Test;Tests
+ Tests 'UT1' 'UT2' 'UT3'
+ Z RunTest ¨ Tests
+ :if ^/ Z
+ 'All ' ( Tests) 'tests passed'
+ :endif
+
+
+:EndNamespace
3 Booking/workcycle.txt
@@ -0,0 +1,3 @@
+)clear
+?????????SE.SALT.Load '/home/gianfranco/APL/Projects/Booking/book*'
+Booking_UT.Test

0 comments on commit 101b0c4

Please sign in to comment.