I am stuck at this exercise and I don’t know what I did wrong. when I run testSection[`exercise1], it fails for 1.3 and says “check if all values are correct”. When I run the test function, it gives the following error message:
2 of 2 tests failed
Failed Tests : 2
feature .f1.createLapTable
should Each Sensor Should Have Start Time From Lap Table
expect (AdvancedCapstone.Functions.test/.f1.createLapTable.quke:6)
Expect Error: type
should Each Sensor Should Have End Time From Lap Table
expect (AdvancedCapstone.Functions.test/.f1.createLapTable.quke:9)
Expect Error: type
Also, am I supposed to run the function on the scratchpad before using testsection? If so, then do I run it with the entire event and sensor tables?
For reference, here is my code:
.f1.createLapTable:{[eventTab;sensorTab]
distinctSensors: distinct select sensorId from sensorTab;
crosspdt:(select from eventTab) cross distinctSensors;
windows:(crosspdt[time];crosspdt[endTime]);
p:wj[windows;datesensorIdtime;select from crosspdt;(select from sensorTab;(avg;sensorValue))];
Your code is working, but your syntax has a mistake. You will need to double check your .f1.createLapTable function to ensure it is returning data.
I have updated your function below if you need help working out where the error is:
.f1.createLapTable:{[eventTab;sensorTab]
distinctSensors: distinct select sensorId from sensorTab;
crosspdt:(select from eventTab) cross distinctSensors;
windows:(crosspdt[time];crosspdt[endTime]);
p:wj[windows;datesensorIdtime;select from crosspdt;(select from sensorTab;(avg;sensorValue))];
delete date from p
}
You can test your function with smaller subsets of the data, and in the next part of section 1 you are asked to use the function to a specific date from the tables.
Oh it was such a silly little mistake! I am used to coding in C++ and hence have a habit of putting a semicolon after every line of code. I have been scratching my head on this for a while and as soon as I removed the accidental semicolon, it passed the test. Thanks!