package som.tests;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.junit.Test;

import som.VM;
import som.VM.Options;


public class VMTests {

  @Test
  public void testProcessArgumentsNothing() {
    Options opts = (new VM(true)).processArguments(new String[0]);
    assertEquals(opts.platformFile, VM.standardPlatformFile);
    assertNull(opts.appFile);
    assertNull(opts.args);
  }

  @Test
  public void testProcessArgumentsWithPlatformFile() {
    Options opts = (new VM(true)).processArguments(
        new String[] {"--platform", "foo.som"});
    assertEquals(opts.platformFile, "foo.som");
    assertNull(opts.appFile);
    assertNull(opts.args);
  }

  @Test
  public void testProcessArgumentsWithAppFile() {
    Options opts = (new VM(true)).processArguments(
        new String[] {"app.som"});
    assertEquals(opts.platformFile, VM.standardPlatformFile);
    assertEquals(opts.appFile, "app.som");
    assertNull(opts.args);
  }

  @Test
  public void testProcessArgumentsWithAppFileAndArgs() {
    Options opts = (new VM(true)).processArguments(
        new String[] {"app.som", "Foo", "1", "2"});
    assertEquals(opts.platformFile, VM.standardPlatformFile);
    assertEquals(opts.appFile, "app.som");
    assertArrayEquals(opts.args, new String[] {"Foo", "1", "2"});
  }
}

@@ -751,32 +751,300 @@
 pts.args);%0A  %7D%0A%0A
+  @Test%0A  public void testProcessArgumentsWithKernelFile() %7B%0A    Options opts = (new VM(true)).processArguments(%0A        new String%5B%5D %7B%22--kernel%22, %22foo.som%22%7D);%0A    assertEquals(opts.kernelFile, %22foo.som%22);%0A    assertNull(opts.appFile);%0A    assertNull(opts.args);%0A  %7D%0A%0A
   @Test%0A  public

Test for parsing --kernel parameter