Hello, Vijay
Attached is the tutorial for explaining how to use JUnit in X10. Hopefully,
itd help to understand our approach and set up the tool.
Best regards,
Myoungkyu
From: Vijay Saraswat [mailto:vi...@saraswat.org]
Sent: Friday, October 29, 2010 5:35 AM
To: Myoungkyu Song
Cc: x10-users@lists.sourceforge.net; 'Eli Tilevich'
Subject: Re: [X10-users] JUnit ???
OK, so what can a person download from where to use this?
On 10/28/2010 10:11 PM, Myoungkyu Song wrote:
>So for an X10 programmer to use this, what do they need?
An X10 programmer needs our separate tool: the PBSE translator and the
code-generator (related to JUnit API).
>So they need a version of the compiler that includes some code from your
group..?
We tested x10 sources under x10c-version-2.0.4, in order to generate the
corresponding Java files.
>They need a separate tool which knows how to process .pbse files, and apply
them to X10 source?
Yes, they need a separate tool which is the PBSE translator which can be
parameterized by PBSE to apply to Java source files generated from X10.
>If so, does your tool understand X10 AST structure/type structure etc.?
Rather than understanding X10 AST/Type directly, we used Java AST toolkit
from Eclipse JDT. Since we managed X10-PBSE version and JAVA-PBSE one, when
the X10 programmers write X10-PBSE version, our tool converts the PBSE into
JAVA-PBSE version.
Best regards,
Myoungkyu Song
From: Vijay Saraswat [mailto:vi...@saraswat.org]
Sent: Thursday, October 28, 2010 9:42 PM
To: Myoungkyu Song
Cc: Eli Tilevich
Subject: Re: [X10-users] JUnit ???
So for an X10 programmer to use this, what do they need?
So they need a version of the compiler that includes some code from your
group..?
They need a separate tool which knows how to process .pbse files, and apply
them to X10 source? (If so, des your tool understand X10 AST structure/type
structure etc.)?
Also can you reply to the list?
On 10/28/2010 9:33 PM, Myoungkyu Song wrote:
Hello, Vijay
I am not sure if our approach fits with what you tried to do, but let me
explain our idea. Our approach consists of writing an X10 source
(TestCompute.java) and PBSE metadata specifications (TestCompute.pbse &
x10_to_java.pbse). It is necessary to declare your methods in the PBSE
specification. Then, the generated Java source (TestCompute.java) from X10
is annotated with JUnit annotation. Attached is the JUnit test driver class
which can be generated automatically by our tool. And I added our submitted
IPDPS and AOSD2010 papers which explain the details.
Best regards,
Myoungkyu Song
//---------------------------------------------------
// TestCompute.x10
//---------------------------------------------------
package compute;
import x10.io.Console;
public class TestCompute {
public def testAQuadCompute() {
var l:double = 0;
var r:double = 100;
var sum:double = 2.5005000000000417E7;
val result = Compute.AQuad.computeArea(l, r);
Console.OUT.println("AQuad Result: " + result);
JUnitTestDriver.assertEquals(sum, result);
}
public def testSQuadCompute() {..}
public def testFQuadCompute() {..}
public def testDQuadCompute() {..}
}
//---------------------------------------------------
// TestCompute.pbse
//---------------------------------------------------
Metadata MyJUit<Package p>
Class c in p
Where(public class Test*)
Method<c>
Metadata Method<Class c>
Method m in c
Where (public def test*)
m...@test
MyJUnit<"compute">
//---------------------------------------------------
// x10_to_java.pbse
//---------------------------------------------------
MetaMetadata PBSEX10toJava<PBSE x10>
where w in x10
Class c in w
Where (public struct *)
Replace "struct" with "class"
Field f in w
Where (private * ${temp1}:${temp2})
Switch ${temp1} and ${temp2}
Where (private * *:*)
Replace ":" with "\s"
Where (private val *:*)
Replace "val" with "final"
Where (private var *:*)
Remove "var"
Method m in w
Where (* def *:${returntype})
Replace "def" with ${returntype}
//---------------------------------------------------
// TestCompute.java
//---------------------------------------------------
package compute;
import org.junit.Test;
public class TestCompute extends x10.core.Ref {
public static final x10.rtt.RuntimeType<compute.TestCompute> _RTT
= new x10.rtt.RuntimeType<compute.TestCompute>(compute.TestCompute.class,
new x10.rtt.Type[] { x10.rtt.Types.runtimeType(java.lang.Object.class) });
public x10.rtt.RuntimeType getRTT() {
return _RTT;
}
@Test
public void testAQuadCompute() {
double l = ((double) (int) (((int) (0))));
double r = ((double) (int) (((int) (100))));
double sum = 2.5005000000000417E7;
final double result =
compute.Compute.AQuad.computeArea((double) (l), (double) (r));
x10.io.Console.OUT.println((("AQuad Result: ") + (result)));
compute.JUnitTestDriver.assertEquals((double) (sum), (double)
(result));
}
@Test
public void testSQuadCompute() { .. }
@Test
public void testFQuadCompute() { .. }
@Test
public void testDQuadCompute() { .. }
public TestCompute() {
super();
}
}
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users