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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package org.reprap.machines;
import java.util.Properties;
import org.reprap.Printer;
import org.reprap.comms.port.TestPort;
import org.reprap.comms.port.testhandlers.TestExtruder;
import org.reprap.comms.port.testhandlers.TestStepper;
import org.reprap.comms.snap.SNAPAddress;
import org.testng.Assert;
/**
*
* @testng.configuration groups = "comms,all,all-offline"
*/
public class ReprapTest {
private Printer printer;
/**
* @testng.configuration beforeSuite = "true"
*/
public void setUp() throws Exception {
// Set up a configuration for testing
Properties props = new Properties();
props.setProperty("PortType", "test"); // Don't use a real port!
props.setProperty("Geometry", "cartesian");
props.setProperty("AxisCount", "3");
props.setProperty("ExtruderCount", "1");
props.setProperty("Axis1Address", "2");
props.setProperty("Axis2Address", "3");
props.setProperty("Axis3Address", "4");
props.setProperty("Axis1Torque", "100");
props.setProperty("Axis2Torque", "100");
props.setProperty("Axis3Torque", "100");
props.setProperty("Extruder1Address", "8");
props.setProperty("Extruder1Beta", "5000");
props.setProperty("Extruder1Rz", "100000");
TestPort port = new TestPort();
port.addDevice(new TestStepper(), new SNAPAddress(2));
port.addDevice(new TestStepper(), new SNAPAddress(3));
port.addDevice(new TestStepper(), new SNAPAddress(4));
port.addDevice(new TestExtruder(), new SNAPAddress(8));
printer = MachineFactory.create(props, port);
}
/**
* @testng.configuration afterSuite = "true"
*/
public void tearDown() {
//printer.dispose();
}
/**
* @testng.test groups = "comms,all,all-offline"
*/
public void testReprapBasic() throws Exception {
printer.moveTo(0, 5, 0);
printer.printTo(10, 12, 0);
Assert.assertEquals(printer.getX(), 10.0, 0.001);
Assert.assertEquals(printer.getY(), 12.0, 0.001);
}
}
|