NameScript { public boolean isNameOp() { switch(op) { case OP_NAME_NEW: case OP_NAME_FIRSTUPDATE: case OP_NAME_UPDATE: return true; case OP_NOP: return false; default: throw new ScriptException("Invalid name op"); } } NameScript(Script baseScript); boolean isNameOp(); Script getAddress(); boolean isAnyUpdate(); ScriptChunk getOpName(); ScriptChunk getOpValue(); static final int OP_NAME_NEW; static final int OP_NAME_FIRSTUPDATE; static final int OP_NAME_UPDATE; }
@Test public void nameUpdateIsNameOp() throws IOException { final NameScript ns = getNameUpdateNameScript(); assertTrue(ns.isNameOp()); }
@Test public void currencyIsNameOp() throws IOException { final NameScript ns = getCurrencyNameScript(); assertFalse(ns.isNameOp()); }
@Test public void returnIsNameOp() throws IOException { final NameScript ns = getReturnNameScript(); assertFalse(ns.isNameOp()); }
@Test public void nameNewIsNameOp() throws IOException { final NameScript ns = getNameNewNameScript(); assertTrue(ns.isNameOp()); }
@Test public void nameFirstUpdateIsNameOp() throws IOException { final NameScript ns = getNameFirstUpdateNameScript(); assertTrue(ns.isNameOp()); }