package pragma;

import static org.junit.Assert.*;
import org.junit.Test;

import x2x.translator.pragma.CLAWpragma;

public class CLAWpragmaTest {

  @Test
  public void isValidTest() {
    // loop-fusion
    assertTrue(CLAWpragma.isValid("claw loop-fusion"));
    assertTrue(CLAWpragma.isValid("claw loop-fusion group(g1)"));
    assertTrue(CLAWpragma.isValid("claw loop-fusion group( g1 )"));
    assertTrue(CLAWpragma.isValid("claw loop-fusion group ( g1   ) "));
    assertFalse(CLAWpragma.isValid("claw loop-fusiongroup(g1)"));
    assertFalse(CLAWpragma.isValid("claw loop-fusion group"));
    assertFalse(CLAWpragma.isValid("claw loop-fusion (i,j,k)"));
    assertFalse(CLAWpragma.isValid("claw loop-fusion group()"));
    assertFalse(CLAWpragma.isValid("claw loop-fusion group(   )"));

    // loop-interchange
    assertTrue(CLAWpragma.isValid("claw loop-interchange"));
    assertTrue(CLAWpragma.isValid("claw loop-interchange (i,j,k)"));
    assertTrue(CLAWpragma.isValid("claw loop-interchange (  i,j,k  ) "));
    assertFalse(CLAWpragma.isValid("claw loop-interchange ()"));
    assertFalse(CLAWpragma.isValid("claw loop-interchange (  )"));

    // loop-extract
    assertTrue(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map(value1:i) map(value2:i)"));
    assertTrue(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map(value1,value2:i)"));
    assertTrue(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map(value1, value2:i)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map(value1, value2)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map(:i)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range(i=istart,iend)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract map(value1:i)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range() map(value1:i)"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range(i=istart,iend) map()"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range() map()"));
    assertFalse(CLAWpragma.isValid("claw loop-extract range map"));


    // invalid dummy directives
    assertFalse(CLAWpragma.isValid("claw"));
    assertFalse(CLAWpragma.isValid("claw dummy-directive"));
  }
}

@@ -2118,16 +2118,137 @@
 p%22));%0A%0A%0A
+    // remove%0A    assertTrue(CLAWpragma.isValid(%22claw remove%22));%0A    assertTrue(CLAWpragma.isValid(%22claw end remove%22));%0A%0A
     // i
@@ -2377,14 +2377,16 @@
 ive%22));%0A
+%0A%0A
   %7D%0A%7D%0A

Add tests for remove directive