mgwidmann / erl8583

Automatically exported from code.google.com/p/erl8583
1 stars 2 forks source link

Errors on eunit test #3

Open nayibor opened 8 years ago

nayibor commented 8 years ago

i run the erl8583 test cases . i run the test_all.erl script and i got a lot of errors . i scaled it down and run the test_asci_marshaller.erl eunit test . below is part of the output below

eunit:test(test_ascii_marshaller).          
test_ascii_marshaller: pan_test...*failed*
in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
  called as marshal_data_element({n,fixed,4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:pan_test/0 (test/test_ascii_marshaller.erl, line 43)
**error:function_clause
  output:<<"">>

test_ascii_marshaller: proc_code_test...*failed*
in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
  called as marshal_data_element({n,fixed,4},<<"0100">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:proc_code_test/0 (test/test_ascii_marshaller.erl, line 49)
**error:function_clause
  output:<<"">>

test_ascii_marshaller: amount_tran_test...*failed*
in function erl8583_marshaller_ascii:marshal_data_element/2 (src/erl8583_marshaller_ascii.erl, line 168)
  called as marshal_data_element({n,fixed,4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:amount_tran_test/0 (test/test_ascii_marshaller.erl, line 55)
**error:function_clause
  output:<<"">>

i traced it down to this line in this line in erl8583_marshaller_ascii.erl

marshal_data_element({n, fixed, Length}, FieldValue) when length(FieldValue) =< Length ->
    IntValue = list_to_integer(FieldValue),
    erl8583_convert:integer_to_string(IntValue, Length);

seems the length(FieldValue) is being passed a binary string instead of as string .

i was wondering if there is anything i can do or if there are any libraries i may have to install that i havent or if its something else Thanks .