public void testReadText() throws FileNotFoundException, IOException { try (final InputStream stream = this.getClass().getResourceAsStream("/test.trm")) { Assert.assertNotNull("Test resource not found", stream); final ATerm t = _factory.readFromTextFile(stream); _baseline = t; } }
@Test public void testFileParser() // XXX seriously we don't care of parsing files. { try { final File file = new File("testAtermFileParser.txt"); if (file.exists()) file.delete(); try (FileOutputStream output = new FileOutputStream(file)) { output.write(_factory.parse("f(a,g(b))").toString().getBytes()); } try (FileInputStream input = new FileInputStream(file)) { final ATerm result = _factory.readFromTextFile(input); System.out.println("result = " + result); } if (file.exists()) file.delete(); } catch (final FileNotFoundException e1) { System.out.println(e1); // TODO : define a logger. } catch (final IOException e2) { System.out.println(e2); } }