-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTest.hx
36 lines (30 loc) · 883 Bytes
/
Test.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import hxSerial.Serial;
class Test extends haxe.unit.TestCase{
public function test():Void {
var devs = Serial.getDeviceList();
assertTrue(devs.length >= 0);
}
static public function main():Void {
// var s = new Serial("/dev/tty.usbserial-A4001tkb",true);
// //this.assertTrue(s.isSetup);
// Sys.sleep(2);
// for (i in 0...2){
// this.assertTrue(s.writeByte(65));
// Sys.sleep(1.5);
// this.assertEquals(2,s.available());
// this.assertEquals(66,s.readByte());
// this.assertEquals(67,s.readByte());
// }
// for (i in 0...2){
// this.assertEquals(1,s.writeBytes("A"));
// Sys.sleep(1.5);
// this.assertEquals(2,s.available());
// this.assertEquals("BC",s.readBytes(2));
// }
// s.close();
var runner = new haxe.unit.TestRunner();
runner.add(new Test());
var success = runner.run();
Sys.exit(success ? 0 : 1);
}
}