@Test public void flow() throws Exception { Set<GetSourceValue> sourcePositions = getSourcePositions("flow.jfl", "dtm"); GetSourceValue offset = new GetSourceValue( "dtm", new ImagePos( Band.DEFAULT, new Pixel(offsetVariable("x", "dx"), offsetVariable("y", "dy")))); assertThat(sourcePositions, hasSize(1)); assertThat(sourcePositions, hasItems(offset)); }
@Test public void pixelDefault() throws Exception { assertThat( Pixel.DEFAULT.toString(), is("_x(),_y()") ); }
@Test public void lifeEdges() throws Exception { Set<GetSourceValue> sourcePositions = getSourcePositions("life-edges.jfl", "world"); GetSourceValue offset = new GetSourceValue( "world", new ImagePos( Band.DEFAULT, new Pixel(offsetVariable("x", "ix"), offsetVariable("y", "iy")))); GetSourceValue original = new GetSourceValue("world", ImagePos.DEFAULT); assertThat(sourcePositions, hasItems(offset, original)); }
@Test public void aspect() throws Exception { Set<GetSourceValue> sourcePositions = getSourcePositions("aspect.jfl", "dtm"); assertThat(sourcePositions, hasSize(5)); assertThat(sourcePositions, hasItems(new GetSourceValue("dtm", ImagePos.DEFAULT))); for (int[] offsets : new int[][] {{0, -1}, {0, 1}, {-1, 0}, {1, 0}}) { assertThat( sourcePositions, hasItems( new GetSourceValue( "dtm", new ImagePos( Band.DEFAULT, new Pixel( offsetLiteral("x", offsets[0]), offsetLiteral("y", offsets[1])))))); } }
@Test public void lifeToroid() throws Exception { Set<GetSourceValue> sourcePositions = getSourcePositions("life-toroid.jfl", "world"); GetSourceValue absolute = new GetSourceValue( "world", new ImagePos( Band.DEFAULT, new Pixel( new Variable("xx", JiffleType.D), new Variable("yy", JiffleType.D)))); GetSourceValue original = new GetSourceValue("world", ImagePos.DEFAULT); assertThat(sourcePositions, hasItems(absolute, original)); }
set(ctx, new Pixel(x, y));
set(ctx, new Pixel(x, y));