Advertisement
Guest User

Untitled

a guest
May 4th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. contract GerenciadorBoletos {
  2.  
  3. struct Boleto {
  4. uint codigoBarra;
  5. uint codigoBarraDigitavel;
  6. uint cpfOuCnpjBeneficiario;
  7. uint cpfOuCnpjPagador;
  8. uint valorOriginal;
  9. uint dataVencimento;
  10. }
  11.  
  12. mapping(uint => Boleto) registroBoletos;
  13.  
  14. function inserirBoleto(
  15. uint codigoBarra,
  16. uint codigoBarraDigitavel,
  17. uint cpfOuCnpjBeneficiario,
  18. uint cpfOuCnpjPagador,
  19. uint valorOriginal,
  20. uint dataVencimento
  21. ) {
  22. Boleto memory b = Boleto(
  23. codigoBarra,
  24. codigoBarraDigitavel,
  25. cpfOuCnpjBeneficiario,
  26. cpfOuCnpjPagador,
  27. valorOriginal,
  28. dataVencimento
  29. );
  30.  
  31. registroBoletos[b.codigoBarra] = b;
  32. }
  33. }
  34.  
  35. describe('1. Inserção', function(){
  36. it('Deve ter inserido um boleto com os dados válidos com sucesso', function(done){
  37. var boletoParaInserir = gerarBoletoValido();
  38. console.log(boletoParaInserir);
  39.  
  40. gerenciadorBoleto.inserirBoleto.sendTransaction(
  41. 9872387128, 987128382, 91289312, 81273818, 50, Date.now() + 3*24*3600,
  42. {
  43. from: web3.eth.accounts[0],
  44. gas: 3000000,
  45. },
  46. function(e, result) {
  47. expect(e).to.not.exist;
  48.  
  49. expect(result).to.exist;
  50. result.should.be.above(0);
  51. }
  52. );
  53. });
  54. });
  55.  
  56. Uncaught AssertionError: expected [Error: Error: VM Exception while
  57. executing transaction: invalid opcode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement