Modify AndGate.test() method to be self-contained.