CS U370 Assignment #2. Assigned: Monday, 27 September 2004 Due: Monday, 4 October 2004 You will write a black-box test program in Java for the Env ADT that is specified below. Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. Part of your grade will be determined by how well you hide your code, part of your grade will be determined by how well you follow the instructions for submitting your code, part of your grade will depend upon the correctness of your code, part of your grade will depend upon the effectiveness of your tests, and part of your grade will depend upon the readability of your code (e.g. formatting and comments). Turn in your work on this assignment before 3 pm on the due date by sending electronic mail to will@ccs.neu.edu with subject CSU370 assignment 2 and a body that consists of nothing but your TestEnv.java file. That file should begin with a block comment that lists 1. Your name, as you want the instructor to write it. 2. Your email address. 3. Any remarks that you wish to make to the instructor. Late assignments may be discounted, and very late assignments may be discarded. -------------------------------------------------- Your assignment is to write the code for a single file, TestEnv.java, that declares a public class named TestEnv that defines a public static void main (String[]) method that, when called with any array of strings as its argument, performs black-box testing of the Env ADT specified below. Your program shall report any failed tests by writing a failure message to System.out. When testing is concluded, your program should write a message to System.out that reports that all tests have been passed if that is true, or reports the number of failed tests if that number is positive. Your black-box test program is a client of the Env ADT, so it must work properly with any correct implementation of this ADT. It should also do a good job of detecting common errors in incorrect implementations of this ADT. -------------------------------------------------- Specification of the Env ADT. The Env ADT is an immutable abstract data type. It shall be implemented by a single file named Env.java. This code shall be in the default package, and shall define a public class named Env that defines the following public static methods, which have no side effects, and are specified by the equations below. public static Env emptyEnv (); public static Env extend (Env, String, int); public static int lookup (Env, String); Algebraic specification: lookup (extend (env, s, n), s0) = n if s.compareTo(s0) is zero lookup (extend (env, s, n), s0) = lookup (env, s0) otherwise Note: This specification does not define lookup on an empty environment. --------------------------------------------------