7 * Java implemention of the reference wchar data supplied to both
8 * clients and servers. This is independently maintained in parallel
9 * with the c++ version, wchar_reference.cpp
11 * @author Phil Mesnier
15 public class WCharReference
17 private char ref_wchar
[] = {1234};
18 private String ref_wstring
[] = {"have a nice day"};
19 private char ref_warray
[][] =
20 { {'a','A','!','1','4','[','?','%','X','E'} };
21 private String ref_except
[] = {"TEST EXCEPTION"};
23 private boolean verbose
= false;
25 public WCharReference ()
29 public WCharReference (boolean v
)
34 public void set_verbose (boolean v
)
39 public char get_wchar (int key
) {
40 return ref_wchar
[key
];
43 public String
get_wstring (int key
) {
44 return ref_wstring
[key
];
47 public char[] get_warray (int key
) {
48 return ref_warray
[key
];
51 public String
get_except (int key
) {
52 return ref_except
[key
];
55 public boolean match_wchar (short key
, char test
)
58 System
.out
.println ("match_wchar: expecting " +
59 ref_wchar
[key
] + " got " +
60 test
+ " for key " + key
);
61 return ref_wchar
[key
] == test
;
64 public boolean match_wstring (short key
, String test
)
68 System
.out
.println ("match_wstring: expcting nul string, " +
69 "got string length " + test
.length());
70 return test
.length() == 0;
73 System
.out
.println ("match_wstring: expecting " +
74 ref_wstring
[key
] + " got " +
75 test
+ " for key " + key
);
76 return test
.equals(ref_wstring
[key
]);
79 public boolean match_warray (short key
, char test
[])
82 System
.out
.println ("match_warray: key " + key
);
83 for (int i
= 0; i
< test
.length
; i
++)
86 System
.out
.println (" expecting[" + i
+ "] " +
87 ref_warray
[key
][i
] + ", got " +
89 if (ref_warray
[key
][i
] != test
[i
])
95 public boolean match_except (short key
, String test
)
98 System
.out
.println ("match_except: expecting " +
99 ref_except
[key
] + " got " +
100 test
+ " for key " + key
);
101 return test
.equals(ref_except
[key
]);