use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_derialize_signature.
@Test
public void test_derialize_signature() throws KeyStoreException {
ECKey key = new ECKey();
String keyID = ECKeyStore.getUniqueID(key);
String serialScript = "15 [sig," + keyID + ",**]";
ScriptBuilder2 res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
serialScript = "15 [sig," + keyID + ",1*]";
res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
serialScript = "15 [sig," + keyID + ",*0]";
res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
serialScript = "15 [sig," + keyID + ",10]";
res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
serialScript = "15 [sig," + keyID + ",*1]";
res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
serialScript = "15 [sig," + keyID + ",11]";
res = new ScriptBuilder2(serialScript);
assertEquals(1, res.signatureSize());
assertEquals(2, res.size());
assertEquals(serialScript, res.serialize());
}
use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_serialize_signature2.
@Test
public void test_serialize_signature2() {
ECKey key = new ECKey();
SigHash hashType = SigHash.ALL;
ScriptBuilder2 sb = new ScriptBuilder2();
sb.number(15);
sb.signaturePlaceholder(key, hashType, true);
String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",1*]";
String actual = sb.serialize();
assertEquals(expected, actual);
}
use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_serialize_signature6.
@Test
public void test_serialize_signature6() {
ECKey key = new ECKey();
SigHash hashType = SigHash.NONE;
ScriptBuilder2 sb = new ScriptBuilder2();
sb.number(15);
sb.signaturePlaceholder(key, hashType, true);
String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",10]";
String actual = sb.serialize();
assertEquals(expected, actual);
}
use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_serialize_signature4.
@Test
public void test_serialize_signature4() {
ECKey key = new ECKey();
SigHash hashType = SigHash.SINGLE;
ScriptBuilder2 sb = new ScriptBuilder2();
sb.number(15);
sb.signaturePlaceholder(key, hashType, true);
String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",11]";
String actual = sb.serialize();
assertEquals(expected, actual);
}
use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.
the class ScriptBuilder2Test method test_serialize_signature3.
@Test
public void test_serialize_signature3() {
ECKey key = new ECKey();
SigHash hashType = SigHash.SINGLE;
ScriptBuilder2 sb = new ScriptBuilder2();
sb.number(15);
sb.signaturePlaceholder(key, hashType, false);
String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",*1]";
String actual = sb.serialize();
assertEquals(expected, actual);
}
Aggregations