build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Exercise: Basic image operations, adult version


Modified 2018-06-22 by Andrea Censi

Andrea Daniele

dt-image-flip specification


Modified 2018-06-22 by Andrea Censi

The program image-ops expects exactly two arguments: a filename (a JPG file) and a directory name.

$ dt-image-flip file outdir

If the file does not exist, the script must exit with error code 2.

If the file cannot be decoded, the script must exit with error code 3.

If the file exists, then the script must create:

  • outdir/regular.jpg: a copy of the initial file
  • outdir/flip.jpg: the file, flipped vertically.
  • outdir/side-by-side.jpg: the two files, side by side.

If any other error occurs, the script should exit with error code 99.

The original picture.
The output flip.jpg
The output side-by-side.jpg
Example input-output for the program image-ops.

Testing it works with image-ops-tester


Modified 2018-06-22 by Andrea Censi

We provide 4 scripts that can be used to make sure that you wrote a conforming dt-image-flip. The scripts are image-ops-tester-good, image-ops-tester-bad1, image-ops-tester-bad2, and image-ops-tester-bad3. You can find them in the directory /exercises/dt-image-flip/image-ops-tester in the duckietown/duckuments repository.

The script called image-ops-tester-good tests your program in a situation in which we expect it to work properly. The 3 “bad” test scripts (i.e., image-ops-tester-bad1 through image-ops-tester-bad3) test your code in situations in which we expect your program to complain in the proper way.

Use them as follows:

$ image-ops-tester-scenario candidate-program

The tester scripts must be called from their own location. Make sure to change your working directory to /exercises/dt-image-flip/image-ops-tester before launching the tester scripts.

If the script cannot be found, image-ops-tester-scenario will return 1.

image-ops-tester-scenario will return 0 if the program exists and conforms to the specification (Section 2.3 - dt-image-flip specification).

If it can establish that the program is not good, it will return 11.

No questions found. You can ask a question on the website.