Domanda

I was testing postfix expression in junit tests where output is same But junit was still failing. I checked the char[] of expected and actual and there i found out character '-' was having different value.

Actual = 4 8 + 6 5 - * 3 2 - 2 2 + * /
Expected = 4 8 + 6 5 - * 3 2 - 2 2 + * /

Now there is "-" character in both string.

[0] = '4' 52
[1] = ' ' 32
[2] = '8' 56
[3] = ' ' 32
[4] = '+' 43
[5] = ' ' 32
[6] = '6' 54
[7] = ' ' 32
[8] = '5' 53
[9] = ' ' 32
**[10] = '-' 45**
[11] = ' ' 32
[12] = '*' 42
[13] = ' ' 32
[14] = '3' 51
[15] = ' ' 32
[16] = '2' 50
[17] = ' ' 32
**[18] = '–' 8211**
[19] = ' ' 32

If you look at char[] element 10 and 18 both have same char but different int value.

When I did char to char comparison it fails at [18] char array index.

I'm running test case on Mac mavericks OS and jdk 1.6 update 65.

Can anyone please tell me is it bug of jdk 1.6 for mac os or something else?

È stato utile?

Soluzione

They are different characters. one small dash and other is long one

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top