### Eclipse Workspace Patch 1.0
#P org.eclipse.equinox.bidi.tests
Index: .classpath
===================================================================
RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/.classpath,v
retrieving revision 1.1
diff -u -r1.1 .classpath
--- .classpath 3 Feb 2010 20:08:12 -0000 1.1
+++ .classpath 6 Feb 2011 17:34:02 -0000
@@ -3,5 +3,6 @@
+
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/.settings/org.eclipse.jdt.core.prefs,v
retrieving revision 1.1
diff -u -r1.1 org.eclipse.jdt.core.prefs
--- .settings/org.eclipse.jdt.core.prefs 3 Feb 2010 20:08:12 -0000 1.1
+++ .settings/org.eclipse.jdt.core.prefs 6 Feb 2011 17:34:02 -0000
@@ -1,7 +1,353 @@
-#Wed Feb 03 11:32:36 EST 2010
+#Wed Feb 02 23:49:56 IST 2011
eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
Index: .settings/org.eclipse.jdt.ui.prefs
===================================================================
RCS file: .settings/org.eclipse.jdt.ui.prefs
diff -N .settings/org.eclipse.jdt.ui.prefs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ .settings/org.eclipse.jdt.ui.prefs 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+#Wed Feb 02 23:49:56 IST 2011
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+internal.default.compliance=user
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
Index: plugin.xml
===================================================================
RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.bidi.tests/plugin.xml,v
retrieving revision 1.1
diff -u -r1.1 plugin.xml
--- plugin.xml 3 Feb 2010 20:08:12 -0000 1.1
+++ plugin.xml 6 Feb 2011 17:34:05 -0000
@@ -5,7 +5,7 @@
id="id2"
point="org.eclipse.equinox.bidi.bidiTypes">
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensibilityTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.BidiComplexHelper;
+import org.eclipse.equinox.bidi.custom.BidiComplexStringProcessor;
+import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor;
+
+/**
+ * Tests contribution of BiDi processors.
+ */
+public class BidiComplexExtensibilityTest extends BidiComplexTestBase {
+
+ public void testBaseContributions() {
+ String[] types = BidiComplexStringProcessor.getKnownTypes();
+ assertNotNull(types);
+ assertTrue(types.length > 0);
+
+ // check one of the types that we know should be there
+ assertTrue(isTypePresent(types, "regex"));
+
+ IBidiComplexProcessor processor = BidiComplexStringProcessor.getProcessor("regex");
+ assertNotNull(processor);
+ }
+
+ public void testOtherContributions() {
+ String[] types = BidiComplexStringProcessor.getKnownTypes();
+ assertNotNull(types);
+ assertTrue(types.length > 0);
+
+ // check the type added by the test bundle
+ assertTrue(isTypePresent(types, "test"));
+
+ IBidiComplexProcessor processor = BidiComplexStringProcessor.getProcessor("test");
+ assertNotNull(processor);
+
+ processor = BidiComplexStringProcessor.getProcessor("badtest");
+ assertNull(processor);
+
+ BidiComplexHelper helper = new BidiComplexHelper("test");
+ String data, lean, full, model;
+ data = "ABC.DEF:HOST-COM=HELLO";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "ABC@.DEF@:HOST@-COM@=HELLO";
+ assertEquals("Test 'test' plugin", model, toPseudo(full));
+ }
+
+ private boolean isTypePresent(String[] types, String type) {
+ for (int i = 0; i < types.length; i++) {
+ if (type.equalsIgnoreCase(types[i]))
+ return true;
+ }
+ return false;
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexExtensionsTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+
+/**
+ * Tests all plug-in extensions
+ */
+
+public class BidiComplexExtensionsTest extends BidiComplexTestBase {
+
+ static int state = BidiComplexHelper.STATE_NOTHING_GOING;
+
+ private void doTest1(BidiComplexHelper complexp, String label, String data, String result) {
+ String full;
+ full = complexp.leanToFullText(toUT16(data), state);
+ state = complexp.getFinalState();
+ assertEquals(label + " data = " + data, result, toPseudo(full));
+ }
+
+ private void doTest2(BidiComplexHelper complexp, String label, String data, String result) {
+ String full;
+ full = complexp.leanToFullText(data, state);
+ state = complexp.getFinalState();
+ assertEquals(label + " data = " + data, result, toPseudo(full));
+ }
+
+ public void testExtensions() {
+
+ BidiComplexHelper helper;
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Email #1", "abc.DEF:GHI", "abc.DEF@:GHI");
+ doTest1(helper, "Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK ");
+ doTest1(helper, "Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK ");
+ doTest1(helper, "Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK ");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.FILE);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Java #1", "A = B + C;", "A@ = B@ + C;");
+ doTest1(helper, "Java #2", "A = B + C;", "A@ = B@ + C;");
+ doTest1(helper, "Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;");
+ doTest1(helper, "Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;");
+ doTest1(helper, "Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;");
+ doTest1(helper, "Java #6", "A = /*B+C*/ D;", "A@ = /*B+C*/@ D;");
+ doTest1(helper, "Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;");
+ doTest1(helper, "Java #8", "X+Y+Z */ B; ", "X+Y+Z */@ B; ");
+ doTest1(helper, "Java #9", "A = //B+C* D;", "A@ = //B+C* D;");
+ doTest1(helper, "Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.PROPERTY);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2");
+ doTest1(helper, "Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2");
+ doTest1(helper, "Property #2", "NAME=VAL1,VAL2=VAL3", "NAME@=VAL1,VAL2=VAL3");
+
+ String data;
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.REGEXP);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ data = toUT16("ABC(?") + "#" + toUT16("DEF)GHI");
+ doTest2(helper, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I");
+ data = toUT16("ABC(?") + "#" + toUT16("DEF");
+ doTest2(helper, "Regex #0.1", data, "A@B@C@(?#DEF");
+ doTest1(helper, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L");
+ data = toUT16("ABC(?") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
+ doTest2(helper, "Regex #1", data, "A@B@C@(?@G@H@I");
+ doTest1(helper, "Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I");
+ doTest1(helper, "Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI");
+ data = toUT16("ABC(?(") + "<" + toUT16("DEF") + ">" + toUT16(")GHI");
+ doTest2(helper, "Regex #3", data, "A@B@C@(?()@G@H@I");
+ doTest1(helper, "Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I");
+ doTest1(helper, "Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I");
+ data = toUT16("ABC(?") + "&" + toUT16("DEF)GHI");
+ doTest2(helper, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I");
+ data = toUT16("ABC(?") + "P<" + toUT16("DEF") + ">" + toUT16("GHI");
+ doTest2(helper, "Regex #7", data, "A@B@C(?p@G@H@I");
+ data = toUT16("ABC\\k") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
+ doTest2(helper, "Regex #8", data, "A@B@C\\k@G@H@I");
+ doTest1(helper, "Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I");
+ doTest1(helper, "Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I");
+ data = toUT16("ABC(?") + "P=" + toUT16("DEF)GHI");
+ doTest2(helper, "Regex #11", data, "A@B@C(?p=DEF)@G@H@I");
+ doTest1(helper, "Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I");
+ data = toUT16("ABC\\g") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
+ doTest2(helper, "Regex #13", data, "A@B@C\\g@G@H@I");
+ doTest1(helper, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I");
+ data = toUT16("ABC(?(") + "R&" + toUT16("DEF)GHI");
+ doTest2(helper, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I");
+ data = toUT16("ABC") + "\\Q" + toUT16("DEF") + "\\E" + toUT16("GHI");
+ doTest2(helper, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I");
+ data = toUT16("ABC") + "\\Q" + toUT16("DEF");
+ doTest2(helper, "Regex #16.1", data, "A@B@C\\qDEF");
+ data = toUT16("GHI") + "\\E" + toUT16("JKL");
+ doTest2(helper, "Regex #16.2", data, "GHI\\eJ@K@L");
+ doTest1(helper, "Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk");
+ doTest1(helper, "Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk");
+ doTest1(helper, "Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2");
+ doTest1(helper, "Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3");
+ doTest1(helper, "Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3");
+ doTest1(helper, "Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3");
+ doTest1(helper, "Regex #17.6", "aB*123", "aB*@123");
+ doTest1(helper, "Regex #17.7", "aB*567", "aB*@567");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SQL);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "SQL #0", "abc GHI", "abc GHI");
+ doTest1(helper, "SQL #1", "abc DEF GHI", "abc DEF@ GHI");
+ doTest1(helper, "SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI");
+ doTest1(helper, "SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN");
+ doTest1(helper, "SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL");
+ doTest1(helper, "SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV");
+ doTest1(helper, "SQL #5", "ABC\"DEF GHI\" JKL,MN", "ABC@\"DEF GHI\"@ JKL@,MN");
+ doTest1(helper, "SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL");
+ doTest1(helper, "SQL #7", "ABC/*DEF GHI*/ JKL,MN", "ABC@/*DEF GHI@*/ JKL@,MN");
+ doTest1(helper, "SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL");
+ doTest1(helper, "SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV");
+ doTest1(helper, "SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL");
+ doTest1(helper, "SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL");
+ doTest1(helper, "SQL #11", "ABC'DEF '' G I' JKL,MN", "ABC@'DEF '' G I'@ JKL@,MN");
+ doTest1(helper, "SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", "ABC@\"DEF \"\" G I\"@ JKL@,MN");
+ doTest1(helper, "SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SYSTEM_USER);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "System #1", "HOST(JACK)", "HOST@(JACK)");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.UNDERSCORE);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.URL);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.XPATH);
+ assertNotNull(helper);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ doTest1(helper, "Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI");
+ doTest1(helper, "Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK ");
+ doTest1(helper, "Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK ");
+ doTest1(helper, "Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK ");
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL);
+ state = BidiComplexHelper.STATE_NOTHING_GOING;
+ BidiComplexFeatures f1 = helper.getFeatures();
+ assertEquals("<>.:,;@", f1.operators);
+ BidiComplexFeatures f2 = new BidiComplexFeatures("+-*/", f1.specialsCount, f1.dirArabic, f1.dirHebrew, f1.ignoreArabic, f1.ignoreHebrew);
+ helper.setFeatures(f2);
+ doTest1(helper, "DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI");
+ doTest1(helper, "DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK ");
+ doTest1(helper, "DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK ");
+ doTest1(helper, "DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ", "DEF@-GHI @(A*B\\)*C) @/JK ");
+ doTest1(helper, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ", "DEF@-GHI @(A\\\\\\)*C) @/JK ");
+ doTest1(helper, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ", "DEF@-GHI @(A\\\\)@*C @/JK ");
+ doTest1(helper, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ", "DEF@-GHI @(A\\)*C /JK ");
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexFullToLeanTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+
+/**
+ * Tests fullToLean method
+ */
+
+public class BidiComplexFullToLeanTest extends BidiComplexTestBase {
+
+ static final BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR);
+
+ static final BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL);
+
+ private BidiComplexHelper helper;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ }
+
+ static int[] getpos(BidiComplexHelper complexp, boolean leanToFull) {
+ int[] pos = new int[5];
+
+ if (leanToFull) {
+ pos[0] = complexp.leanToFullPos(0);
+ pos[1] = complexp.leanToFullPos(4);
+ pos[2] = complexp.leanToFullPos(7);
+ pos[3] = complexp.leanToFullPos(10);
+ pos[4] = complexp.leanToFullPos(30);
+ } else {
+ pos[0] = complexp.fullToLeanPos(0);
+ pos[1] = complexp.fullToLeanPos(4);
+ pos[2] = complexp.fullToLeanPos(7);
+ pos[3] = complexp.fullToLeanPos(10);
+ pos[4] = complexp.fullToLeanPos(30);
+ }
+ return pos;
+ }
+
+ private void doTest1(String msg, String data, String leanLTR, String fullLTR, int[] l2fPosLTR, int[] f2lPosLTR, String leanRTL, String fullRTL, int[] l2fPosRTL, int[] f2lPosRTL) {
+ String text, full, lean, label;
+ int[] pos;
+
+ text = toUT16(data);
+ helper.setEnvironment(envLTR);
+ lean = helper.fullToLeanText(text);
+ assertEquals(msg + "LTR lean", leanLTR, toPseudo(lean));
+ full = helper.leanToFullText(lean);
+ assertEquals(msg + "LTR full", fullLTR, toPseudo(full));
+ pos = getpos(helper, true);
+ label = msg + "leanToFullPos() LTR, expected=" + array_display(l2fPosLTR) + " result=" + array_display(pos);
+ assertTrue(label, arrays_equal(l2fPosLTR, pos));
+ pos = getpos(helper, false);
+ label = msg + "fullToLeanPos() LTR, expected=" + array_display(f2lPosLTR) + " result=" + array_display(pos);
+ assertTrue(label, arrays_equal(f2lPosLTR, pos));
+ helper.setEnvironment(envRTL);
+ lean = helper.fullToLeanText(text);
+ assertEquals(msg + "RTL lean", leanRTL, toPseudo(lean));
+ full = helper.leanToFullText(lean);
+ assertEquals(msg + "RTL full", fullRTL, toPseudo(full));
+ pos = getpos(helper, true);
+ label = msg + "leanToFullPos() RTL, expected=" + array_display(l2fPosRTL) + " result=" + array_display(pos);
+ assertTrue(label, arrays_equal(l2fPosRTL, pos));
+ pos = getpos(helper, false);
+ label = msg + "fullToLeanPos() RTL, expected=" + array_display(f2lPosRTL) + " result=" + array_display(pos);
+ assertTrue(label, arrays_equal(f2lPosRTL, pos));
+ }
+
+ private void doTest2(String msg) {
+ String text, data, full, lean, model;
+ int state, state2, state3;
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.SQL);
+ helper.setEnvironment(envLTR);
+ data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK";
+ text = toUT16(data);
+ lean = helper.fullToLeanText(text);
+ state = helper.getFinalState();
+ model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK";
+ assertEquals(msg + "LTR lean", model, toPseudo(lean));
+ full = helper.leanToFullText(lean);
+ assertEquals(msg + "LTR full", data, toPseudo(full));
+ assertEquals(msg + "state from leanToFullText", helper.getFinalState(), state);
+ data = "THIS IS A COMMENT LINE";
+ text = toUT16(data);
+ lean = helper.fullToLeanText(text, state);
+ state2 = helper.getFinalState();
+ model = "THIS IS A COMMENT LINE";
+ assertEquals(msg + "LTR lean2", model, toPseudo(lean));
+ full = helper.leanToFullText(lean, state);
+ assertEquals(msg + "LTR full2", data, toPseudo(full));
+ assertEquals(msg + "state from leanToFullText2", helper.getFinalState(), state2);
+ data = "SOME MORE */ where \"COL3\"@=123";
+ text = toUT16(data);
+ lean = helper.fullToLeanText(text, state2);
+ state3 = helper.getFinalState();
+ model = "SOME MORE */ where \"COL3\"=123";
+ assertEquals(msg + "LTR lean3", model, toPseudo(lean));
+ full = helper.leanToFullText(lean, state2);
+ assertEquals(msg + "LTR full3", data, toPseudo(full));
+ assertEquals(msg + "state from leanToFullText3", helper.getFinalState(), state3);
+ }
+
+ public void testFullToLean() {
+
+ doTest1("testFullToLean #1 - ", "", "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}, "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0});
+ doTest1("testFullToLean #01 - ", "1.abc", "1.abc", "1.abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "1.abc", ">@1.abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5});
+ doTest1("testFullToLean #02 - ", "2.abc,def", "2.abc,def", "2.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "2.abc,def", ">@2.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #03 - ", "@a.3.bc,def", "a.3.bc,def", "a.3.bc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 10}, "a.3.bc,def", ">@a.3.bc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 10});
+ doTest1("testFullToLean #04 - ", "@@a.4.bc,def", "a.4.bc,def", "a.4.bc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 10}, "a.4.bc,def", ">@a.4.bc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 10});
+ doTest1("testFullToLean #05 - ", "@5.abc,def", "5.abc,def", "5.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "5.abc,def", ">@5.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #06 - ", "@@6.abc,def", "6.abc,def", "6.abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "6.abc,def", ">@6.abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #07 - ", "7abc,@def", "7abc,@def", "7abc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "7abc,@def", ">@7abc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #08 - ", "8abc,@@def", "8abc,@def", "8abc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "8abc,@def", ">@8abc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #09 - ", "9abc,def@", "9abc,def", "9abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 8, 8}, "9abc,def", ">@9abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 8});
+ doTest1("testFullToLean #10 - ", "10abc,def@@", "10abc,def", "10abc,def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "10abc,def", ">@10abc,def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #11 - ", "@a.11.bc,@def@", "a.11.bc,@def", "a.11.bc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 12}, "a.11.bc,@def", ">@a.11.bc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 12});
+ doTest1("testFullToLean #12 - ", "@@a.12.bc,@@def@@", "a.12.bc,@def", "a.12.bc,@def", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 12}, "a.12.bc,@def", ">@a.12.bc,@def@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 12});
+ doTest1("testFullToLean #13 - ", "13ABC", "13ABC", "13ABC", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "13ABC", ">@13ABC@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5});
+ doTest1("testFullToLean #14 - ", "14ABC,DE", "14ABC,DE", "14ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "14ABC,DE", ">@14ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8});
+ doTest1("testFullToLean #15 - ", "15ABC@,DE", "15ABC,DE", "15ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "15ABC,DE", ">@15ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8});
+ doTest1("testFullToLean #16 - ", "16ABC@@,DE", "16ABC,DE", "16ABC@,DE", new int[] {0, 4, 8, 11, 31}, new int[] {0, 4, 6, 8, 8}, "16ABC,DE", ">@16ABC@,DE@^", new int[] {2, 6, 10, 13, 33}, new int[] {0, 2, 5, 7, 8});
+ doTest1("testFullToLean #17 - ", "17ABC,@@DE", "17ABC,@DE", "17ABC,@DE", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 9, 9}, "17ABC,@DE", ">@17ABC,@DE@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 9});
+ doTest1("testFullToLean #18 - ", "18ABC,DE,FGH", "18ABC,DE,FGH", "18ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "18ABC,DE,FGH", ">@18ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #19 - ", "19ABC@,DE@,FGH", "19ABC,DE,FGH", "19ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "19ABC,DE,FGH", ">@19ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #20 - ", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 14}, "20ABC,@DE,@FGH", ">@20ABC,@DE,@FGH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 14});
+ doTest1("testFullToLean #21 - ", "21ABC@@,DE@@,FGH", "21ABC,DE,FGH", "21ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "21ABC,DE,FGH", ">@21ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #22 - ", "22ABC,@@DE,@@FGH", "22ABC,@DE,@FGH", "22ABC,@DE,@FGH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 14}, "22ABC,@DE,@FGH", ">@22ABC,@DE,@FGH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 14});
+ doTest1("testFullToLean #23 - ", ">@23abc@^", "23abc", "23abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "23abc", ">@23abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5});
+ doTest1("testFullToLean #24 - ", "24abc@^", "24abc", "24abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "24abc", ">@24abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5});
+ doTest1("testFullToLean #25 - ", ">@25abc", "25abc", "25abc", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 5, 5, 5}, "25abc", ">@25abc@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 5, 5});
+ doTest1("testFullToLean #26 - ", "26AB,CD@EF,GHI", "26AB,CD@EF,GHI", "26AB@,CD@EF@,GHI", new int[] {0, 5, 8, 12, 32}, new int[] {0, 4, 6, 9, 14}, "26AB,CD@EF,GHI", ">@26AB@,CD@EF@,GHI@^", new int[] {2, 7, 10, 14, 34}, new int[] {0, 2, 4, 7, 14});
+ doTest1("testFullToLean #27 - ", "27AB,CD@123ef,GHI", "27AB,CD@123ef,GHI", "27AB@,CD@123ef,GHI", new int[] {0, 5, 8, 11, 31}, new int[] {0, 4, 6, 9, 17}, "27AB,CD@123ef,GHI", ">@27AB@,CD@123ef,GHI@^", new int[] {2, 7, 10, 13, 33}, new int[] {0, 2, 4, 7, 17});
+ doTest1("testFullToLean #28 - ", ">28ABC@,DE@,FGH^", "28ABC,DE,FGH", "28ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "28ABC,DE,FGH", ">@28ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #29 - ", ">>29ABC@,DE@,FGH^^", "29ABC,DE,FGH", "29ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "29ABC,DE,FGH", ">@29ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #30 - ", ">30AB>C^@,DE@,FGH^", "30AB>C^,DE,FGH", "30AB>C^@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 7, 9, 14}, "30AB>C^,DE,FGH", ">@30AB>C^@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 14});
+ doTest1("testFullToLean #31 - ", ">31AB>C@,DE@,FGH^^", "31AB>C,DE,FGH", "31AB>C@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 9, 13}, "31AB>C,DE,FGH", ">@31AB>C@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 13});
+ doTest1("testFullToLean #32 - ", ">@32ABC@,DE@,FGH@^", "32ABC,DE,FGH", "32ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "32ABC,DE,FGH", ">@32ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #33 - ", "@33ABC@,DE@,FGH@^", "33ABC,DE,FGH", "33ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "33ABC,DE,FGH", ">@33ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #34 - ", ">@34ABC@,DE@,FGH@", "34ABC,DE,FGH", "34ABC@,DE@,FGH", new int[] {0, 4, 8, 12, 32}, new int[] {0, 4, 6, 8, 12}, "34ABC,DE,FGH", ">@34ABC@,DE@,FGH@^", new int[] {2, 6, 10, 14, 34}, new int[] {0, 2, 5, 7, 12});
+ doTest1("testFullToLean #35 - ", "35ABC@@DE@@@GH@", "35ABC@DE@GH", "35ABC@DE@GH", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 10, 11}, "35ABC@DE@GH", ">@35ABC@DE@GH@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 11});
+ doTest1("testFullToLean #36 - ", "36ABC@@DE@@@@@@", "36ABC@DE", "36ABC@DE", new int[] {0, 4, 7, 10, 30}, new int[] {0, 4, 7, 8, 8}, "36ABC@DE", ">@36ABC@DE@^", new int[] {2, 6, 9, 12, 32}, new int[] {0, 2, 5, 8, 8});
+ doTest1("testFullToLean #37 - ", ">>>@@@@@^^^", "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0}, "", "", new int[] {0, 4, 7, 10, 30}, new int[] {0, 0, 0, 0, 0});
+
+ // test fullToLeanText with initial state
+ doTest2("testFullToLean #38 - ");
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMathTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+
+/**
+ * Tests RTL arithmetic
+ */
+public class BidiComplexMathTest extends BidiComplexTestBase {
+
+ static final BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR);
+
+ static final BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL);
+
+ private BidiComplexHelper helper;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.RTL_ARITHMETIC);
+ }
+
+ private void verifyOneLine(String msg, String data, String resLTR, String resRTL) {
+ String lean = toUT16(data);
+ helper.setEnvironment(envLTR);
+ String fullLTR = helper.leanToFullText(lean);
+ assertEquals(msg + " LTR - ", resLTR, toPseudo(fullLTR));
+
+ helper.setEnvironment(envRTL);
+ String fullRTL = helper.leanToFullText(lean);
+ assertEquals(msg + " RTL - ", resRTL, toPseudo(fullRTL));
+ }
+
+ public void testRTLarithmetic() {
+ verifyOneLine("Math #0", "", "", "");
+ verifyOneLine("Math #1", "1+abc", "<&1+abc&^", "1+abc");
+ verifyOneLine("Math #2", "2+abc-def", "<&2+abc&-def&^", "2+abc&-def");
+ verifyOneLine("Math #3", "a+3*bc/def", "<&a&+3*bc&/def&^", "a&+3*bc&/def");
+ verifyOneLine("Math #4", "4+abc/def", "<&4+abc&/def&^", "4+abc&/def");
+ verifyOneLine("Math #5", "13ABC", "<&13ABC&^", "13ABC");
+ verifyOneLine("Math #6", "14ABC-DE", "<&14ABC-DE&^", "14ABC-DE");
+ verifyOneLine("Math #7", "15ABC+DE", "<&15ABC+DE&^", "15ABC+DE");
+ verifyOneLine("Math #8", "16ABC*DE", "<&16ABC*DE&^", "16ABC*DE");
+ verifyOneLine("Math #9", "17ABC/DE", "<&17ABC/DE&^", "17ABC/DE");
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexMethodsTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+
+/**
+ * Tests most public methods of BidiComplexHelper
+ */
+
+public class BidiComplexMethodsTest extends BidiComplexTestBase {
+
+ final static int LTR = BidiComplexFeatures.DIR_LTR;
+
+ final static int RTL = BidiComplexFeatures.DIR_RTL;
+
+ final static BidiComplexEnvironment envLTR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR);
+
+ final static BidiComplexEnvironment envRTL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_RTL);
+
+ final static BidiComplexEnvironment envRTLMIR = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_RTL);
+
+ final static BidiComplexEnvironment envIGN = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_IGNORE);
+
+ final static BidiComplexEnvironment envCLR = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_CONTEXTUAL_LTR);
+
+ final static BidiComplexEnvironment envCRL = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_CONTEXTUAL_RTL);
+
+ final static BidiComplexEnvironment envERR = new BidiComplexEnvironment(null, false, 9999);
+
+ BidiComplexHelper helper;
+
+ private void doTestTools() {
+
+ // This method tests utility methods used by the JUnits
+ String data = "56789ABCDEFGHIJKLMNOPQRSTUVWXYZ~#@&><^|`";
+ String text = toUT16(data);
+ String dat2 = toPseudo(text);
+ assertEquals(data, dat2);
+
+ text = toPseudo(data);
+ assertEquals("56789abcdefghijklmnopqrstuvwxyz~#@&><^|`", text);
+
+ int[] arrayA = new int[] {1, 2};
+ int[] arrayB = new int[] {3, 4, 5};
+ assertFalse(arrays_equal(arrayA, arrayB));
+
+ assertTrue(arrays_equal(arrayA, arrayA));
+
+ arrayB = new int[] {3, 4};
+ assertFalse(arrays_equal(arrayA, arrayB));
+
+ text = array_display(null);
+ assertEquals("null", text);
+ }
+
+ private void doTestState() {
+ String data, lean, full, model;
+ int state;
+
+ data = "A=B+C;/* D=E+F;";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "A@=B@+C@;/* D=E+F;";
+ assertEquals("full1", model, toPseudo(full));
+ state = helper.getFinalState();
+ data = "A=B+C; D=E+F;";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean, state);
+ model = "A=B+C; D=E+F;";
+ assertEquals("full2", model, toPseudo(full));
+ state = helper.getFinalState();
+ data = "A=B+C;*/ D=E+F;";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean, state);
+ model = "A=B+C;*/@ D@=E@+F;";
+ assertEquals("full3", model, toPseudo(full));
+ }
+
+ private void doTestOrientation() {
+ int orient;
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ orient = helper.getEnvironment().orientation;
+ assertEquals("orient #1", BidiComplexEnvironment.ORIENT_LTR, orient);
+
+ helper.setEnvironment(envIGN);
+ orient = helper.getEnvironment().orientation;
+ assertEquals("orient #2", BidiComplexEnvironment.ORIENT_IGNORE, orient);
+
+ helper.setEnvironment(envCRL);
+ orient = helper.getEnvironment().orientation;
+ helper.leanToFullText("--!**");
+ assertEquals("orient #3", BidiComplexEnvironment.ORIENT_CONTEXTUAL_RTL, orient);
+
+ helper.setEnvironment(envERR);
+ orient = helper.getEnvironment().orientation;
+ helper.leanToFullText("--!**");
+ assertEquals("orient #4", BidiComplexEnvironment.ORIENT_UNKNOWN, orient);
+ }
+
+ private void doTestOrient(BidiComplexFeatures f, String label, String data, String resLTR, String resRTL, String resCon) {
+ String full, lean;
+
+ lean = toUT16(data);
+ helper.setEnvironment(envLTR);
+ helper.setFeatures(f);
+ full = helper.leanToFullText(lean);
+ assertEquals(label + "LTR full", resLTR, toPseudo(full));
+ helper.setEnvironment(envRTL);
+ helper.setFeatures(f);
+ full = helper.leanToFullText(lean);
+ assertEquals("label + RTL full", resRTL, toPseudo(full));
+ helper.setEnvironment(envCRL);
+ helper.setFeatures(f);
+ full = helper.leanToFullText(lean);
+ assertEquals(label + "CON full", resCon, toPseudo(full));
+ }
+
+ private void doTestScripts() {
+ BidiComplexFeatures f2, f1 = helper.getFeatures();
+ boolean flag;
+ flag = f1.ignoreArabic;
+ assertFalse("Ignores Arabic 1", flag);
+ flag = f1.ignoreHebrew;
+ assertFalse("Ignores Hebrew 1", flag);
+
+ f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, true, true);
+ flag = f2.ignoreArabic;
+ assertTrue("Ignores Arabic 2", flag);
+ flag = f2.ignoreHebrew;
+ assertTrue("Ignores Hebrew 2", flag);
+ doTestOrient(f2, "Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF");
+ f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, false, true);
+ flag = f2.ignoreArabic;
+ assertFalse("Ignores Arabic 3", flag);
+ flag = f2.ignoreHebrew;
+ assertTrue("Ignores Hebrew 3", flag);
+ doTestOrient(f2, "Scripts #2 ", "d,EF", "d,EF", ">@d,EF@^", "d,EF");
+ doTestOrient(f2, "Scripts #3 ", "#,eF", "#,eF", ">@#,eF@^", "@#,eF");
+ doTestOrient(f2, "Scripts #4 ", "#,12", "#@,12", ">@#@,12@^", "@#@,12");
+ doTestOrient(f2, "Scripts #5 ", "#,##", "#@,##", ">@#@,##@^", "@#@,##");
+ doTestOrient(f2, "Scripts #6 ", "#,89", "#@,89", ">@#@,89@^", "@#@,89");
+ doTestOrient(f2, "Scripts #7 ", "#,ef", "#,ef", ">@#,ef@^", "@#,ef");
+ doTestOrient(f2, "Scripts #8 ", "#,", "#,", ">@#,@^", "@#,");
+ doTestOrient(f2, "Scripts #9 ", "9,ef", "9,ef", ">@9,ef@^", "9,ef");
+ doTestOrient(f2, "Scripts #10 ", "9,##", "9@,##", ">@9@,##@^", "9@,##");
+ doTestOrient(f2, "Scripts #11 ", "7,89", "7@,89", ">@7@,89@^", "7@,89");
+ doTestOrient(f2, "Scripts #12 ", "7,EF", "7,EF", ">@7,EF@^", "@7,EF");
+ doTestOrient(f2, "Scripts #13 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF");
+
+ f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, true, false);
+ flag = f2.ignoreArabic;
+ assertTrue("Ignores Arabic 4", flag);
+ flag = f2.ignoreHebrew;
+ assertFalse("Ignores Hebrew 4", flag);
+ doTestOrient(f2, "Scripts #14 ", "BCd,EF", "BCd,EF", ">@BCd,EF@^", "@BCd,EF");
+ doTestOrient(f2, "Scripts #15 ", "BCD,eF", "BCD,eF", ">@BCD,eF@^", "@BCD,eF");
+ doTestOrient(f2, "Scripts #16 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF");
+ doTestOrient(f2, "Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^", "@BCD@,12");
+ doTestOrient(f2, "Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,");
+
+ f2 = new BidiComplexFeatures(f1.operators, 0, -1, -1, false, false);
+ doTestOrient(f2, "Scripts #19 ", "123,45|67", "123,45|67", ">@123,45|67@^", "@123,45|67");
+ doTestOrient(f2, "Scripts #20 ", "5,e", "5,e", ">@5,e@^", "5,e");
+ doTestOrient(f2, "Scripts #21 ", "5,#", "5@,#", ">@5@,#@^", "5@,#");
+ doTestOrient(f2, "Scripts #22 ", "5,6", "5@,6", ">@5@,6@^", "5@,6");
+ doTestOrient(f2, "Scripts #23 ", "5,D", "5@,D", ">@5@,D@^", "5@,D");
+ doTestOrient(f2, "Scripts #24 ", "5,--", "5,--", ">@5,--@^", "@5,--");
+ }
+
+ private void doTestLeanOffsets() {
+ String lean, data, label;
+ int state;
+ int[] offsets;
+ int[] model;
+
+ data = "A=B+C;/* D=E+F;";
+ lean = toUT16(data);
+ helper.leanToFullText(lean);
+ offsets = helper.leanBidiCharOffsets();
+ model = new int[] {1, 3, 5};
+ label = "leanBidiCharOffsets() #1 expected=" + array_display(model) + " result=" + array_display(offsets);
+ assertTrue(label, arrays_equal(model, offsets));
+ state = helper.getFinalState();
+ data = "A=B+C;*/ D=E+F;";
+ lean = toUT16(data);
+ helper.leanToFullText(lean, state);
+ offsets = helper.leanBidiCharOffsets();
+ model = new int[] {8, 10, 12};
+ label = "leanBidiCharOffsets() #2 expected=" + array_display(model) + " result=" + array_display(offsets);
+ assertTrue(label, arrays_equal(model, offsets));
+ offsets = helper.leanBidiCharOffsets();
+ model = new int[] {8, 10, 12};
+ label = "leanBidiCharOffsets() #3 expected=" + array_display(model) + " result=" + array_display(offsets);
+ assertTrue(label, arrays_equal(model, offsets));
+ }
+
+ private void doTestFullOffsets(String label, String data, int[] resLTR, int[] resRTL, int[] resCon) {
+ String full, lean, msg;
+ int[] offsets;
+
+ lean = toUT16(data);
+ helper.setEnvironment(envLTR);
+ full = helper.leanToFullText(lean);
+ // the following line avoids a compiler warning about full never being
+ // read
+ full += "";
+ offsets = helper.fullBidiCharOffsets();
+ msg = label + "LTR expected=" + array_display(resLTR) + " result=" + array_display(offsets);
+ assertTrue(msg, arrays_equal(resLTR, offsets));
+ helper.setEnvironment(envRTL);
+ full = helper.leanToFullText(lean);
+ offsets = helper.fullBidiCharOffsets();
+ msg = label + "RTL expected=" + array_display(resRTL) + " result=" + array_display(offsets);
+ assertTrue(msg, arrays_equal(resRTL, offsets));
+ helper.setEnvironment(envCLR);
+ full = helper.leanToFullText(lean);
+ offsets = helper.fullBidiCharOffsets();
+ msg = label + "CON expected=" + array_display(resCon) + " result=" + array_display(offsets);
+ assertTrue(msg, arrays_equal(resCon, offsets));
+ }
+
+ private void doTestMirrored() {
+ boolean mirrored;
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ mirrored = helper.getEnvironment().mirrored;
+ assertFalse("mirrored #1", mirrored);
+ BidiComplexEnvironment env = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_LTR);
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED, env);
+ mirrored = helper.getEnvironment().mirrored;
+ assertTrue("mirrored #2", mirrored);
+ }
+
+ private void doTestDirection() {
+ String data, lean, full, model, msg;
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ BidiComplexFeatures f1 = helper.getFeatures();
+ msg = "TestDirection #1";
+ assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR);
+
+ BidiComplexFeatures f2 = new BidiComplexFeatures(f1.operators, 0, RTL, RTL, false, false);
+ helper.setFeatures(f2);
+ f1 = helper.getFeatures();
+ msg = "TestDirection #2";
+ assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == RTL);
+
+ BidiComplexEnvironment environment = new BidiComplexEnvironment(null, false, BidiComplexEnvironment.ORIENT_LTR);
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.EMAIL, environment);
+ f1 = helper.getFeatures();
+ msg = "TestDirection #3";
+ assertTrue(msg, f1.dirArabic == LTR && f1.dirHebrew == LTR);
+ data = "#ABC.#DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "#ABC@.#DEF@:HOST.com";
+ assertEquals("TestDirection #9 full", model, toPseudo(full));
+
+ data = "ABC.DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "ABC@.DEF@:HOST.com";
+ assertEquals("TestDirection #10 full", model, toPseudo(full));
+
+ environment = new BidiComplexEnvironment(null, true, BidiComplexEnvironment.ORIENT_LTR);
+ helper.setEnvironment(environment);
+ f1 = helper.getFeatures();
+ msg = "TestDirection #10.5";
+ assertTrue(msg, f1.dirArabic == RTL && f1.dirHebrew == LTR);
+ data = "#ABC.#DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "<ABC.#DEF:HOST.com&^";
+ assertEquals("TestDirection #11 full", model, toPseudo(full));
+
+ data = "#ABc.#DEF:HOSt.COM";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "<ABc.#DEF:HOSt.COM&^";
+ assertEquals("TestDirection #12 full", model, toPseudo(full));
+
+ data = "#ABc.#DEF:HOSt.";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "<ABc.#DEF:HOSt.&^";
+ assertEquals("TestDirection #13 full", model, toPseudo(full));
+
+ data = "ABC.DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "ABC@.DEF@:HOST.com";
+ assertEquals("TestDirection #14 full", model, toPseudo(full));
+
+ data = "--.---:----";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "--.---:----";
+ assertEquals("TestDirection #15 full", model, toPseudo(full));
+
+ data = "ABC.|DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "ABC.|DEF@:HOST.com";
+ assertEquals("TestDirection #16 full", model, toPseudo(full));
+
+ helper.setEnvironment(envRTLMIR);
+ data = "#ABc.|#DEF:HOST.com";
+ lean = toUT16(data);
+ full = helper.leanToFullText(lean);
+ model = "#ABc.|#DEF:HOST.com";
+ assertEquals("TestDirection #17 full", model, toPseudo(full));
+ assertEquals("Test curDirection", RTL, helper.getCurDirection());
+ }
+
+ public void testMethods() {
+
+ doTestTools();
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA);
+ doTestState();
+
+ doTestOrientation();
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ BidiComplexFeatures f2 = helper.getFeatures();
+ doTestOrient(f2, "Methods #1 ", "", "", "", "");
+ doTestOrient(f2, "Methods #2 ", "abc", "abc", ">@abc@^", "abc");
+ doTestOrient(f2, "Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC");
+ doTestOrient(f2, "Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef");
+ doTestOrient(f2, "Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^", "@BCD@,EF");
+ doTestOrient(f2, "Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG");
+ doTestOrient(f2, "Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg");
+ doTestOrient(f2, "Methods #8 ", "12..def,GH", "12..def,GH", ">@12..def,GH@^", "12..def,GH");
+ doTestOrient(f2, "Methods #9 ", "34..DEF,gh", "34..DEF,gh", ">@34..DEF,gh@^", "@34..DEF,gh");
+
+ doTestScripts();
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.JAVA);
+ doTestLeanOffsets();
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ doTestFullOffsets("TestFullOffsets ", "BCD,EF,G", new int[] {3, 7}, new int[] {0, 1, 5, 9, 12, 13}, new int[] {0, 4, 8});
+
+ doTestMirrored();
+
+ doTestDirection();
+
+ helper = new BidiComplexHelper(IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
+ String lean = toUT16(data);
+ String full = helper.leanToFullText(lean);
+ String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z";
+ assertEquals("many inserts", model, toPseudo(full));
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexNullProcessorTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+
+/**
+ * Tests RTL arithmetic
+ */
+public class BidiComplexNullProcessorTest extends BidiComplexTestBase {
+
+ static final int[] EMPTY_INT_ARRAY = new int[0];
+
+ private BidiComplexHelper helper;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ helper = new BidiComplexHelper();
+ }
+
+ public void testNullProcessor() {
+ String full = helper.leanToFullText("abc");
+ assertEquals("leanToFullText", "abc", full);
+ full = helper.leanToFullText("abc", 3);
+ assertEquals("leanToFullText with state", "abc", full);
+ int[] offsets = helper.leanBidiCharOffsets();
+ assertTrue("leanBidiCharOffsets", arrays_equal(offsets, EMPTY_INT_ARRAY));
+ offsets = helper.fullBidiCharOffsets();
+ assertTrue("fullBidiCharOffsets", arrays_equal(offsets, EMPTY_INT_ARRAY));
+ String lean = helper.fullToLeanText("abc");
+ assertEquals("fullToLeanText", "abc", lean);
+ lean = helper.fullToLeanText("abc", 3);
+ assertEquals("fullToLeanText with state", "abc", lean);
+ int state = helper.getFinalState();
+ assertEquals("getFinalState", BidiComplexHelper.STATE_NOTHING_GOING, state);
+ int pos = helper.leanToFullPos(13);
+ assertEquals("leanToFullPos", 13, pos);
+ pos = helper.fullToLeanPos(15);
+ assertEquals("fullToLeanPos", 15, pos);
+ assertEquals("getDirProp", Character.DIRECTIONALITY_UNDEFINED, helper.getDirProp(123));
+ int direction = helper.getCurDirection();
+ assertEquals("getCurDirection", BidiComplexFeatures.DIR_LTR, direction);
+ BidiComplexEnvironment env = helper.getEnvironment();
+ assertEquals("getEnvironment", BidiComplexEnvironment.DEFAULT, env);
+ helper.setEnvironment(env);
+ BidiComplexFeatures features = helper.getFeatures();
+ assertEquals("getFeatures", BidiComplexFeatures.DEFAULT, features);
+ helper.setFeatures(features);
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexSomeMoreTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+import org.eclipse.equinox.bidi.custom.BidiComplexProcessor;
+import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor;
+
+/**
+ * Tests some weird cases
+ */
+
+public class BidiComplexSomeMoreTest extends BidiComplexTestBase {
+
+ final static BidiComplexEnvironment env1 = new BidiComplexEnvironment("en_US", false, BidiComplexEnvironment.ORIENT_LTR);
+
+ final static BidiComplexEnvironment env2 = new BidiComplexEnvironment("he", false, BidiComplexEnvironment.ORIENT_LTR);
+
+ final static BidiComplexFeatures features = new BidiComplexFeatures(null, 1, -1, -1, false, false);
+
+ BidiComplexHelper helper;
+
+ class Processor1 extends BidiComplexProcessor {
+
+ public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) {
+ return features;
+ }
+
+ public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) {
+ return fromIndex;
+ }
+
+ public int processSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int operLocation) {
+ int len = srcText.length();
+ for (int i = len - 1; i >= 0; i--) {
+ caller.insertMark(i);
+ caller.insertMark(i);
+ }
+ return len;
+ }
+ }
+
+ class Processor2 extends BidiComplexProcessor {
+
+ public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) {
+ return features;
+ }
+ }
+
+ class Processor3 extends BidiComplexProcessor {
+
+ public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) {
+ return features;
+ }
+
+ public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) {
+ return 0;
+ }
+ }
+
+ public void testSomeMore() {
+ assertFalse(env1.isBidi());
+ assertTrue(env2.isBidi());
+
+ IBidiComplexProcessor processor = new Processor1();
+ helper = new BidiComplexHelper(processor, env1);
+ String full = toPseudo(helper.leanToFullText("abcd"));
+ assertEquals("@a@b@c@d", full);
+
+ processor = new Processor2();
+ helper = new BidiComplexHelper(processor, env1);
+ boolean catchFlag = false;
+ try {
+ full = toPseudo(helper.leanToFullText("abcd"));
+ } catch (IllegalStateException e) {
+ catchFlag = true;
+ }
+ assertTrue("Catch missing indexOfSpecial", catchFlag);
+
+ processor = new Processor3();
+ helper = new BidiComplexHelper(processor, env1);
+ catchFlag = false;
+ try {
+ full = toPseudo(helper.leanToFullText("abcd"));
+ } catch (IllegalStateException e) {
+ catchFlag = true;
+ }
+ assertTrue("Catch missing processSpecial", catchFlag);
+ }
+
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.bidi.internal.tests;
+
+import org.eclipse.equinox.bidi.*;
+import org.eclipse.equinox.bidi.custom.IBidiComplexProcessor;
+
+public class BidiComplexTest implements IBidiComplexProcessor {
+
+ static final BidiComplexFeatures FEATURES = new BidiComplexFeatures("-=.:", 0, -1, -1, false, false);
+
+ public BidiComplexFeatures init(BidiComplexHelper caller, BidiComplexEnvironment env) {
+ return FEATURES;
+ }
+
+ public BidiComplexFeatures updateEnvironment(BidiComplexHelper caller, BidiComplexEnvironment env) {
+ return FEATURES;
+ }
+
+ public int indexOfSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int fromIndex) {
+ throw new IllegalStateException();
+ }
+
+ public int processSpecial(BidiComplexHelper caller, int caseNumber, String srcText, int operLocation) {
+ throw new IllegalStateException();
+ }
+
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexTestBase.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import junit.framework.TestCase;
+
+/**
+ * Base functionality for the processor tests.
+ */
+public class BidiComplexTestBase extends TestCase {
+
+ static final private char LRM = 0x200E;
+
+ static final private char RLM = 0x200F;
+
+ static final private char LRE = 0x202A;
+
+ static final private char RLE = 0x202B;
+
+ static final private char PDF = 0x202C;
+
+ public static String toPseudo(String text) {
+ char[] chars = text.toCharArray();
+ int len = chars.length;
+
+ for (int i = 0; i < len; i++) {
+ char c = chars[i];
+ if (c >= 'A' && c <= 'Z')
+ chars[i] = (char) (c + 'a' - 'A');
+ else if (c >= 0x05D0 && c < 0x05EA)
+ chars[i] = (char) (c + 'A' - 0x05D0);
+ else if (c == 0x05EA)
+ chars[i] = '~';
+ else if (c == 0x0644)
+ chars[i] = '#';
+ else if (c >= 0x0665 && c <= 0x0669)
+ chars[i] = (char) (c + '5' - 0x0665);
+ else if (c == LRM)
+ chars[i] = '@';
+ else if (c == RLM)
+ chars[i] = '&';
+ else if (c == LRE)
+ chars[i] = '>';
+ else if (c == RLE)
+ chars[i] = '<';
+ else if (c == PDF)
+ chars[i] = '^';
+ else if (c == '\n')
+ chars[i] = '|';
+ else if (c == '\r')
+ chars[i] = '`';
+ }
+ return new String(chars);
+ }
+
+ public static String toUT16(String text) {
+ char[] chars = text.toCharArray();
+ int len = chars.length;
+
+ for (int i = 0; i < len; i++) {
+ char c = chars[i];
+ if (c >= '5' && c <= '9')
+ chars[i] = (char) (0x0665 + c - '5');
+ else if (c >= 'A' && c <= 'Z')
+ chars[i] = (char) (0x05D0 + c - 'A');
+ else if (c == '~')
+ chars[i] = (char) (0x05EA);
+ else if (c == '#')
+ chars[i] = (char) (0x0644);
+ else if (c == '@')
+ chars[i] = LRM;
+ else if (c == '&')
+ chars[i] = RLM;
+ else if (c == '>')
+ chars[i] = LRE;
+ else if (c == '<')
+ chars[i] = RLE;
+ else if (c == '^')
+ chars[i] = PDF;
+ else if (c == '|')
+ chars[i] = '\n';
+ else if (c == '`')
+ chars[i] = '\r';
+ }
+ return new String(chars);
+ }
+
+ static String array_display(int[] array) {
+ if (array == null) {
+ return "null";
+ }
+ StringBuffer sb = new StringBuffer(50);
+ int len = array.length;
+ for (int i = 0; i < len; i++) {
+ sb.append(array[i]);
+ sb.append(' ');
+ }
+ return sb.toString();
+ }
+
+ static boolean arrays_equal(int[] one, int[] two) {
+ int len = one.length;
+ if (len != two.length) {
+ return false;
+ }
+ for (int i = 0; i < len; i++) {
+ if (one[i] != two[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexUtilTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/BidiComplexUtilTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/BidiComplexUtilTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/internal/tests/BidiComplexUtilTest.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.internal.tests;
+
+import java.util.Locale;
+import org.eclipse.equinox.bidi.BidiComplexUtil;
+import org.eclipse.equinox.bidi.IBidiComplexExpressionTypes;
+
+/**
+ * Tests methods in BidiComplexUtil
+ */
+
+public class BidiComplexUtilTest extends BidiComplexTestBase {
+
+ private static final String HEBREW = "iw";
+
+ private static final String HEBREW2 = "he";
+
+ private static final String ARABIC = "ar";
+
+ private static final String FARSI = "fa";
+
+ private static final String URDU = "ur";
+
+ private Locale locale;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ locale = Locale.getDefault();
+ }
+
+ protected void tearDown() {
+ Locale.setDefault(locale);
+ }
+
+ private void doTest1(String data, String result) {
+ Locale.setDefault(Locale.ENGLISH);
+ String full = BidiComplexUtil.process(toUT16(data));
+ assertEquals("Util #1 full EN - ", data, toPseudo(full));
+ Locale.setDefault(new Locale(HEBREW2));
+ full = BidiComplexUtil.process(toUT16(data));
+ assertEquals("Util #1 full HE - ", result, toPseudo(full));
+ Locale.setDefault(new Locale(ARABIC));
+ full = BidiComplexUtil.process(toUT16(data));
+ assertEquals("Util #1 full AR - ", result, toPseudo(full));
+ Locale.setDefault(new Locale(FARSI));
+ full = BidiComplexUtil.process(toUT16(data));
+ assertEquals("Util #1 full FA - ", result, toPseudo(full));
+ Locale.setDefault(new Locale(URDU));
+ full = BidiComplexUtil.process(toUT16(data));
+ assertEquals("Util #1 full UR - ", result, toPseudo(full));
+ Locale.setDefault(new Locale(HEBREW));
+ full = BidiComplexUtil.process(toUT16(data));
+ String ful2 = BidiComplexUtil.process(toUT16(data), null);
+ assertEquals("Util #1 full - ", result, toPseudo(full));
+ assertEquals("Util #1 ful2 - ", result, toPseudo(ful2));
+ String lean = BidiComplexUtil.deprocess(full);
+ assertEquals("Util #1 lean - ", data, toPseudo(lean));
+ }
+
+ private void doTest2(String msg, String data, String result) {
+ doTest2(msg, data, result, data);
+ }
+
+ private void doTest2(String msg, String data, String result, String resLean) {
+ String full = BidiComplexUtil.process(toUT16(data), "*");
+ assertEquals(msg + "full", result, toPseudo(full));
+ String lean = BidiComplexUtil.deprocess(full);
+ assertEquals(msg + "lean", resLean, toPseudo(lean));
+ }
+
+ private void doTest3(String msg, String data, String result) {
+ doTest3(msg, data, result, data);
+ }
+
+ private void doTest3(String msg, String data, String result, String resLean) {
+ String full = BidiComplexUtil.processTyped(toUT16(data), IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ assertEquals(msg + "full", result, toPseudo(full));
+ String lean = BidiComplexUtil.deprocess(full, IBidiComplexExpressionTypes.COMMA_DELIMITED);
+ assertEquals(msg + "lean", resLean, toPseudo(lean));
+ }
+
+ private void doTest4(String msg, String data, int[] offsets, int direction, boolean affix, String result) {
+ String txt = msg + "text=" + data + "\n offsets=" + array_display(offsets) + "\n direction=" + direction + "\n affix=" + affix;
+ String lean = toUT16(data);
+ String full = BidiComplexUtil.insertMarks(lean, offsets, direction, affix);
+ assertEquals(txt, result, toPseudo(full));
+ }
+
+ public void testBidiComplexUtil() {
+
+ // Test process() and deprocess() with default delimiters
+ doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^");
+ // Test process() and deprocess() with specified delimiters
+ doTest2("Util #2.1 - ", "", "");
+ doTest2("Util #2.2 - ", ">@ABC@^", ">@ABC@^", "ABC");
+ doTest2("Util #2.3 - ", "abc", "abc");
+ doTest2("Util #2.4 - ", "!abc", ">@!abc@^");
+ doTest2("Util #2.5 - ", "abc!", ">@abc!@^");
+ doTest2("Util #2.6 - ", "ABC*DEF*G", ">@ABC@*DEF@*G@^");
+ // Test process() and deprocess() with specified expression type
+ doTest3("Util #3.1 - ", "ABC,DEF,G", ">@ABC@,DEF@,G@^");
+ doTest3("Util #3.2 - ", "", "");
+ doTest3("Util #3.3 - ", ">@DEF@^", ">@DEF@^", "DEF");
+ boolean catchFlag = false;
+ try {
+ BidiComplexUtil.deprocess(toUT16("ABC,DE"), "wrong_type");
+ } catch (IllegalArgumentException e) {
+ catchFlag = true;
+ }
+ assertTrue("Catch invalid type on deprocess", catchFlag);
+ catchFlag = false;
+ try {
+ BidiComplexUtil.processTyped("abc", "wrong_type");
+ } catch (IllegalArgumentException e) {
+ catchFlag = true;
+ }
+ assertTrue("Catch invalid type on process", catchFlag);
+ // Test insertMarks()
+ doTest4("Util #4.1 - ", "ABCDEFG", new int[] {3, 6}, 0, false, "ABC@DEF@G");
+ doTest4("Util #4.2 - ", "ABCDEFG", new int[] {3, 6}, 0, true, ">@ABC@DEF@G@^");
+ doTest4("Util #4.3 - ", "ABCDEFG", new int[] {3, 6}, 1, false, "ABC&DEF&G");
+ doTest4("Util #4.4 - ", "ABCDEFG", new int[] {3, 6}, 1, true, "<&ABC&DEF&G&^");
+ doTest4("Util #4.5 - ", "", new int[] {3, 6}, 0, false, "");
+ doTest4("Util #4.6 - ", "", new int[] {3, 6}, 0, true, "");
+ doTest4("Util #4.7 - ", "ABCDEFG", null, 1, false, "ABCDEFG");
+ doTest4("Util #4.8 - ", "ABCDEFG", null, 1, true, "<&ABCDEFG&^");
+ }
+}
Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpMathTest.java 17 Mar 2010 17:53:44 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor;
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-import org.eclipse.equinox.bidi.complexp.StringProcessor;
-
-/**
- * Tests RTL arithmetic
- */
-public class ComplExpMathTest extends ComplExpTestBase {
-
- private IComplExpProcessor processor;
-
- protected void setUp() throws Exception {
- super.setUp();
- processor = StringProcessor.getProcessor(IBiDiProcessor.RTL_ARITHMETIC);
- }
-
- private void verifyOneLine(String msg, String data, String resLTR,
- String resRTL) {
- String lean = toUT16(data);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- String fullLTR = processor.leanToFullText(lean);
- assertEquals(msg + " LTR - ", resLTR, toPseudo(fullLTR));
-
- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL);
- String fullRTL = processor.leanToFullText(lean);
- assertEquals(msg + " RTL - ", resRTL, toPseudo(fullRTL));
- }
-
- public void testRTLarithmetic() {
- verifyOneLine("Math #0", "", "", "");
- verifyOneLine("Math #1", "1+abc", "<&1+abc&^", "1+abc");
- verifyOneLine("Math #2", "2+abc-def", "<&2+abc&-def&^", "2+abc&-def");
- verifyOneLine("Math #3", "a+3*bc/def", "<&a&+3*bc&/def&^",
- "a&+3*bc&/def");
- verifyOneLine("Math #4", "4+abc/def", "<&4+abc&/def&^", "4+abc&/def");
- verifyOneLine("Math #5", "13ABC", "<&13ABC&^", "13ABC");
- verifyOneLine("Math #6", "14ABC-DE", "<&14ABC-DE&^", "14ABC-DE");
- verifyOneLine("Math #7", "15ABC+DE", "<&15ABC+DE&^", "15ABC+DE");
- verifyOneLine("Math #8", "16ABC*DE", "<&16ABC*DE&^", "16ABC*DE");
- verifyOneLine("Math #9", "17ABC/DE", "<&17ABC/DE&^", "17ABC/DE");
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpTest.java 17 Mar 2010 17:53:43 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-
-public class ComplExpTest implements IComplExpProcessor {
-
- private static final int[] EMPTY_INT_ARRAY = new int[0];
- private static final int[][] ALL_LTR = new int[][] {
- { DIRECTION_LTR, DIRECTION_LTR }, { DIRECTION_LTR, DIRECTION_LTR } };
-
- public ComplExpTest() {
- return;
- }
-
- public void setOperators(String operators) {
- // empty
- }
-
- public String getOperators() {
- return "";
- }
-
- public void selectBidiScript(boolean arabic, boolean hebrew) {
- // empty
- }
-
- public boolean handlesArabicScript() {
- return false;
- }
-
- public boolean handlesHebrewScript() {
- return false;
- }
-
- public String leanToFullText(String text) {
- return text;
- }
-
- public String leanToFullText(String text, int initState) {
- return text;
- }
-
- public int[] leanBidiCharOffsets(String text) {
- return EMPTY_INT_ARRAY;
- }
-
- public int[] leanBidiCharOffsets(String text, int initState) {
- return EMPTY_INT_ARRAY;
- }
-
- public int[] leanBidiCharOffsets() {
- return EMPTY_INT_ARRAY;
- }
-
- public int[] fullBidiCharOffsets() {
- return EMPTY_INT_ARRAY;
- }
-
- public String fullToLeanText(String text) {
- return text;
- }
-
- public String fullToLeanText(String text, int initState) {
- return text;
- }
-
- public int getFinalState() {
- return STATE_NOTHING_GOING;
- }
-
- public int leanToFullPos(int pos) {
- return pos;
- }
-
- public int fullToLeanPos(int pos) {
- return pos;
- }
-
- public void assumeMirrored(boolean mirrored) {
- // empty
- }
-
- public boolean isMirrored() {
- return false;
- }
-
- public void assumeOrientation(int orientation) {
- // empty
- }
-
- public int recallOrientation() {
- return ORIENT_LTR;
- }
-
- public void setArabicDirection(int not_mirrored, int mirrored) {
- // empty
- }
-
- public void setArabicDirection(int direction) {
- // empty
- }
-
- public void setHebrewDirection(int not_mirrored, int mirrored) {
- // empty
- }
-
- public void setHebrewDirection(int direction) {
- // empty
- }
-
- public void setDirection(int not_mirrored, int mirrored) {
- // empty
- }
-
- public void setDirection(int direction) {
- // empty
- }
-
- public int[][] getDirection() {
- return ALL_LTR;
- }
-
- public int getCurDirection() {
- return DIRECTION_LTR;
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java
--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpTestBase.java 17 Mar 2010 17:53:44 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import junit.framework.TestCase;
-
-/**
- * Base functionality for the processor tests.
- */
-public class ComplExpTestBase extends TestCase {
-
- static final private char LRM = 0x200E;
- static final private char RLM = 0x200F;
- static final private char LRE = 0x202A;
- static final private char RLE = 0x202B;
- static final private char PDF = 0x202C;
-
- protected String toPseudo(String text) {
- char[] chars = text.toCharArray();
- int len = chars.length;
-
- for (int i = 0; i < len; i++) {
- char c = chars[i];
- if (c >= 'A' && c <= 'Z')
- chars[i] = (char) (c + 'a' - 'A');
- else if (c >= 0x05D0 && c < 0x05EA)
- chars[i] = (char) (c + 'A' - 0x05D0);
- else if (c == 0x05EA)
- chars[i] = '~';
- else if (c == 0x0644)
- chars[i] = '#';
- else if (c >= 0x0665 && c <= 0x0669)
- chars[i] = (char) (c + '5' - 0x0665);
- else if (c == LRM)
- chars[i] = '@';
- else if (c == RLM)
- chars[i] = '&';
- else if (c == LRE)
- chars[i] = '>';
- else if (c == RLE)
- chars[i] = '<';
- else if (c == PDF)
- chars[i] = '^';
- else if (c == '\n')
- chars[i] = '|';
- else if (c == '\r')
- chars[i] = '`';
- }
- return new String(chars);
- }
-
- protected String toUT16(String text) {
- char[] chars = text.toCharArray();
- int len = chars.length;
-
- for (int i = 0; i < len; i++) {
- char c = chars[i];
- if (c >= '5' && c <= '9')
- chars[i] = (char) (0x0665 + c - '5');
- else if (c >= 'A' && c <= 'Z')
- chars[i] = (char) (0x05D0 + c - 'A');
- else if (c == '~')
- chars[i] = (char) (0x05EA);
- else if (c == '#')
- chars[i] = (char) (0x0644);
- else if (c == '@')
- chars[i] = LRM;
- else if (c == '&')
- chars[i] = RLM;
- else if (c == '>')
- chars[i] = LRE;
- else if (c == '<')
- chars[i] = RLE;
- else if (c == '^')
- chars[i] = PDF;
- else if (c == '|')
- chars[i] = '\n';
- else if (c == '`')
- chars[i] = '\r';
- }
- return new String(chars);
- }
-
- static String array_display(int[] array) {
- if (array == null) {
- return "null";
- }
- StringBuffer sb = new StringBuffer(50);
- int len = array.length;
- for (int i = 0; i < len; i++) {
- sb.append(array[i]);
- sb.append(' ');
- }
- return sb.toString();
- }
-
- static boolean arrays_equal(int[] one, int[] two) {
- int len = one.length;
- if (len != two.length) {
- return false;
- }
- for (int i = 0; i < len; i++) {
- if (one[i] != two[i]) {
- return false;
- }
- }
- return true;
- }
-
- static boolean arrays2_equal(int[][] one, int[][] two) {
- int dim1, dim2;
- dim1 = one.length;
- if (dim1 != two.length) {
- return false;
- }
- for (int i = 0; i < dim1; i++) {
- dim2 = one[i].length;
- if (dim2 != two[i].length) {
- return false;
- }
- for (int j = 0; j < dim2; j++) {
- if (one[i][j] != two[i][j]) {
- return false;
- }
- }
- }
- return true;
- }
-
- static String array2_display(int[][] array) {
- int dim1, dim2;
- if (array == null) {
- return "null";
- }
- StringBuffer sb = new StringBuffer(50);
- dim1 = array.length;
- for (int i = 0; i < dim1; i++) {
- dim2 = array[i].length;
- for (int j = 0; j < dim2; j++) {
- sb.append(array[i][j]);
- sb.append(' ');
- }
- }
- return sb.toString();
- }
-
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/ComplExpUtilTest.java 17 Mar 2010 17:53:44 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.*;
-import java.util.Locale;
-
-/**
- * Tests methods in ComplExpUtil
- */
-
-public class ComplExpUtilTest extends ComplExpTestBase {
-
- private static final String HEBREW = "iw";
- private static final String HEBREW2 = "he";
- private static final String ARABIC = "ar";
- private static final String FARSI = "fa";
- private static final String URDU = "ur";
- private Locale locale;
-
- protected void setUp() throws Exception {
- super.setUp();
- locale = Locale.getDefault();
- }
-
- protected void tearDown() {
- Locale.setDefault(locale);
- }
-
- private void doTest1(String data, String result) {
- Locale.setDefault(Locale.ENGLISH);
- String full = ComplExpUtil.process(toUT16(data));
- assertEquals("Util #1 full EN - ", data, toPseudo(full));
- Locale.setDefault(new Locale(HEBREW2));
- full = ComplExpUtil.process(toUT16(data));
- assertEquals("Util #1 full HE - ", result, toPseudo(full));
- Locale.setDefault(new Locale(ARABIC));
- full = ComplExpUtil.process(toUT16(data));
- assertEquals("Util #1 full AR - ", result, toPseudo(full));
- Locale.setDefault(new Locale(FARSI));
- full = ComplExpUtil.process(toUT16(data));
- assertEquals("Util #1 full FA - ", result, toPseudo(full));
- Locale.setDefault(new Locale(URDU));
- full = ComplExpUtil.process(toUT16(data));
- assertEquals("Util #1 full UR - ", result, toPseudo(full));
- Locale.setDefault(new Locale(HEBREW));
- full = ComplExpUtil.process(toUT16(data));
- String ful2 = ComplExpUtil.process(toUT16(data), null);
- assertEquals("Util #1 full - ", result, toPseudo(full));
- assertEquals("Util #1 ful2 - ", result, toPseudo(ful2));
- String lean = ComplExpUtil.deprocess(full);
- assertEquals("Util #1 lean - ", data, toPseudo(lean));
- }
-
- private void doTest2(String msg, String data, String result) {
- doTest2(msg, data, result, data);
- }
-
- private void doTest2(String msg, String data, String result, String resLean) {
- String full = ComplExpUtil.process(toUT16(data), "*");
- assertEquals(msg + "full", result, toPseudo(full));
- String lean = ComplExpUtil.deprocess(full);
- assertEquals(msg + "lean", resLean, toPseudo(lean));
- }
-
- private void doTest3(String msg, String data, String result) {
- doTest3(msg, data, result, data);
- }
-
- private void doTest3(String msg, String data, String result, String resLean) {
- String full = ComplExpUtil.processTyped(toUT16(data),
- IBiDiProcessor.COMMA_DELIMITED);
- assertEquals(msg + "full", result, toPseudo(full));
- String lean = ComplExpUtil.deprocess(full,
- IBiDiProcessor.COMMA_DELIMITED);
- assertEquals(msg + "lean", resLean, toPseudo(lean));
- }
-
- private void doTest4(String msg, String data, int[] offsets, int direction,
- boolean affix, String result) {
- String txt = msg + "text=" + data + "\n offsets="
- + array_display(offsets) + "\n direction=" + direction
- + "\n affix=" + affix;
- String lean = toUT16(data);
- String full = ComplExpUtil.insertMarks(lean, offsets, direction, affix);
- assertEquals(txt, result, toPseudo(full));
- }
-
- public void testComplExpUtil() {
-
- // Test process() and deprocess() with default delimiters
- doTest1("ABC/DEF/G", ">@ABC@/DEF@/G@^");
- // Test process() and deprocess() with specified delimiters
- doTest2("Util #2.1 - ", "", "");
- doTest2("Util #2.2 - ", ">@ABC@^", ">@ABC@^", "ABC");
- doTest2("Util #2.3 - ", "abc", "abc");
- doTest2("Util #2.4 - ", "!abc", ">@!abc@^");
- doTest2("Util #2.5 - ", "abc!", ">@abc!@^");
- doTest2("Util #2.6 - ", "ABC*DEF*G", ">@ABC@*DEF@*G@^");
- // Test process() and deprocess() with specified expression type
- doTest3("Util #3.1 - ", "ABC,DEF,G", ">@ABC@,DEF@,G@^");
- doTest3("Util #3.2 - ", "", "");
- doTest3("Util #3.3 - ", ">@DEF@^", ">@DEF@^", "DEF");
- String str = ComplExpUtil.deprocess(toUT16("ABC,DE"), "wrong_type");
- assertEquals("deprocess(9999)", "ABC,DE", toPseudo(str));
- str = ComplExpUtil.process("abc", "wrong_type");
- assertEquals("invalid type", "abc", toPseudo(str));
- // Test insertMarks()
- doTest4("Util #4.1 - ", "ABCDEFG", new int[] { 3, 6 }, 0, false,
- "ABC@DEF@G");
- doTest4("Util #4.2 - ", "ABCDEFG", new int[] { 3, 6 }, 0, true,
- ">@ABC@DEF@G@^");
- doTest4("Util #4.3 - ", "ABCDEFG", new int[] { 3, 6 }, 1, false,
- "ABC&DEF&G");
- doTest4("Util #4.4 - ", "ABCDEFG", new int[] { 3, 6 }, 1, true,
- "<&ABC&DEF&G&^");
- doTest4("Util #4.5 - ", "", new int[] { 3, 6 }, 0, false, "");
- doTest4("Util #4.6 - ", "", new int[] { 3, 6 }, 0, true, "");
- doTest4("Util #4.7 - ", "ABCDEFG", null, 1, false, "ABCDEFG");
- doTest4("Util #4.8 - ", "ABCDEFG", null, 1, true, "<&ABCDEFG&^");
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/ExtensibilityTest.java 17 Mar 2010 17:53:44 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-import org.eclipse.equinox.bidi.complexp.StringProcessor;
-
-/**
- * Tests contribution of BiDi processors.
- */
-public class ExtensibilityTest extends TestCase {
-
- public void testBaseContributions() {
- String[] types = StringProcessor.getKnownTypes();
- assertNotNull(types);
- assertTrue(types.length > 0);
-
- // check one of the types that we know should be there
- assertTrue(isTypePresent(types, "regex"));
-
- IComplExpProcessor processor = StringProcessor.getProcessor("regex");
- assertNotNull(processor);
- }
-
- public void testOtherContributions() {
- String[] types = StringProcessor.getKnownTypes();
- assertNotNull(types);
- assertTrue(types.length > 0);
-
- // check the type added by the test bundle
- assertTrue(isTypePresent(types, "test"));
-
- IComplExpProcessor processor = StringProcessor.getProcessor("test");
- assertNotNull(processor);
- }
-
- private boolean isTypePresent(String[] types, String type) {
- for (int i = 0; i < types.length; i++) {
- if (type.equalsIgnoreCase(types[i]))
- return true;
- }
- return false;
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/ExtensionsTest.java 17 Mar 2010 17:53:44 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-import org.eclipse.equinox.bidi.complexp.StringProcessor;
-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor;
-
-/**
- * Tests all plug-in extensions
- */
-
-public class ExtensionsTest extends ComplExpTestBase {
-
- static int state = IComplExpProcessor.STATE_NOTHING_GOING;
-
- private void doTest1(IComplExpProcessor complexp, String label,
- String data, String result) {
- String full;
- full = complexp.leanToFullText(toUT16(data), state);
- state = complexp.getFinalState();
- assertEquals(label + " data = " + data, result, toPseudo(full));
- }
-
- private void doTest2(IComplExpProcessor complexp, String label,
- String data, String result) {
- String full;
- full = complexp.leanToFullText(data, state);
- state = complexp.getFinalState();
- assertEquals(label + " data = " + data, result, toPseudo(full));
- }
-
- public void testExtensions() {
-
- IComplExpProcessor ce;
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.EMAIL);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Email #1", "abc.DEF:GHI", "abc.DEF@:GHI");
- doTest1(ce, "Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK ");
- doTest1(ce, "Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK ");
- doTest1(ce, "Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK ");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.FILE);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.JAVA);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Java #1", "A = B + C;", "A@ = B@ + C;");
- doTest1(ce, "Java #2", "A = B + C;", "A@ = B@ + C;");
- doTest1(ce, "Java #3", "A = \"B+C\"+D;", "A@ = \"B+C\"@+D;");
- doTest1(ce, "Java #4", "A = \"B+C+D;", "A@ = \"B+C+D;");
- doTest1(ce, "Java #5", "A = \"B\\\"C\"+D;", "A@ = \"B\\\"C\"@+D;");
- doTest1(ce, "Java #6", "A = /*B+C*/ D;", "A@ = /*B+C*/@ D;");
- doTest1(ce, "Java #7", "A = /*B+C* D;", "A@ = /*B+C* D;");
- doTest1(ce, "Java #8", "X+Y+Z */ B; ", "X+Y+Z */@ B; ");
- doTest1(ce, "Java #9", "A = //B+C* D;", "A@ = //B+C* D;");
- doTest1(ce, "Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.PROPERTY);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2");
- doTest1(ce, "Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2");
- doTest1(ce, "Property #2", "NAME=VAL1,VAL2=VAL3",
- "NAME@=VAL1,VAL2=VAL3");
-
- String data;
- ce = StringProcessor.getProcessor(IBiDiProcessor.REGEXP);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- data = toUT16("ABC(?") + "#" + toUT16("DEF)GHI");
- doTest2(ce, "Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I");
- data = toUT16("ABC(?") + "#" + toUT16("DEF");
- doTest2(ce, "Regex #0.1", data, "A@B@C@(?#DEF");
- doTest1(ce, "Regex #0.2", "GHI)JKL", "GHI)@J@K@L");
- data = toUT16("ABC(?") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
- doTest2(ce, "Regex #1", data, "A@B@C@(?@G@H@I");
- doTest1(ce, "Regex #2.0", "ABC(?'DEF'GHI", "A@B@C@(?'DEF'@G@H@I");
- doTest1(ce, "Regex #2.1", "ABC(?'DEFGHI", "A@B@C@(?'DEFGHI");
- data = toUT16("ABC(?(") + "<" + toUT16("DEF") + ">" + toUT16(")GHI");
- doTest2(ce, "Regex #3", data, "A@B@C@(?()@G@H@I");
- doTest1(ce, "Regex #4", "ABC(?('DEF')GHI", "A@B@C@(?('DEF')@G@H@I");
- doTest1(ce, "Regex #5", "ABC(?(DEF)GHI", "A@B@C@(?(DEF)@G@H@I");
- data = toUT16("ABC(?") + "&" + toUT16("DEF)GHI");
- doTest2(ce, "Regex #6", data, "A@B@C@(?&DEF)@G@H@I");
- data = toUT16("ABC(?") + "P<" + toUT16("DEF") + ">" + toUT16("GHI");
- doTest2(ce, "Regex #7", data, "A@B@C(?p@G@H@I");
- data = toUT16("ABC\\k") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
- doTest2(ce, "Regex #8", data, "A@B@C\\k@G@H@I");
- doTest1(ce, "Regex #9", "ABC\\k'DEF'GHI", "A@B@C\\k'DEF'@G@H@I");
- doTest1(ce, "Regex #10", "ABC\\k{DEF}GHI", "A@B@C\\k{DEF}@G@H@I");
- data = toUT16("ABC(?") + "P=" + toUT16("DEF)GHI");
- doTest2(ce, "Regex #11", data, "A@B@C(?p=DEF)@G@H@I");
- doTest1(ce, "Regex #12", "ABC\\g{DEF}GHI", "A@B@C\\g{DEF}@G@H@I");
- data = toUT16("ABC\\g") + "<" + toUT16("DEF") + ">" + toUT16("GHI");
- doTest2(ce, "Regex #13", data, "A@B@C\\g@G@H@I");
- doTest1(ce, "Regex #14", "ABC\\g'DEF'GHI", "A@B@C\\g'DEF'@G@H@I");
- data = toUT16("ABC(?(") + "R&" + toUT16("DEF)GHI");
- doTest2(ce, "Regex #15", data, "A@B@C(?(r&DEF)@G@H@I");
- data = toUT16("ABC") + "\\Q" + toUT16("DEF") + "\\E" + toUT16("GHI");
- doTest2(ce, "Regex #16.0", data, "A@B@C\\qDEF\\eG@H@I");
- data = toUT16("ABC") + "\\Q" + toUT16("DEF");
- doTest2(ce, "Regex #16.1", data, "A@B@C\\qDEF");
- data = toUT16("GHI") + "\\E" + toUT16("JKL");
- doTest2(ce, "Regex #16.2", data, "GHI\\eJ@K@L");
- doTest1(ce, "Regex #17.0", "abc[d-h]ijk", "abc[d-h]ijk");
- doTest1(ce, "Regex #17.1", "aBc[d-H]iJk", "aBc[d-H]iJk");
- doTest1(ce, "Regex #17.2", "aB*[!-H]iJ2", "aB*[!-@H]iJ@2");
- doTest1(ce, "Regex #17.3", "aB*[1-2]J3", "aB*[@1-2]J@3");
- doTest1(ce, "Regex #17.4", "aB*[5-6]J3", "aB*[@5-@6]@J@3");
- doTest1(ce, "Regex #17.5", "a*[5-6]J3", "a*[5-@6]@J@3");
- doTest1(ce, "Regex #17.6", "aB*123", "aB*@123");
- doTest1(ce, "Regex #17.7", "aB*567", "aB*@567");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.SQL);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "SQL #0", "abc GHI", "abc GHI");
- doTest1(ce, "SQL #1", "abc DEF GHI", "abc DEF@ GHI");
- doTest1(ce, "SQL #2", "ABC, DEF, GHI", "ABC@, DEF@, GHI");
- doTest1(ce, "SQL #3", "ABC'DEF GHI' JKL,MN", "ABC@'DEF GHI'@ JKL@,MN");
- doTest1(ce, "SQL #4.0", "ABC'DEF GHI JKL", "ABC@'DEF GHI JKL");
- doTest1(ce, "SQL #4.1", "MNO PQ' RS,TUV", "MNO PQ'@ RS@,TUV");
- doTest1(ce, "SQL #5", "ABC\"DEF GHI\" JKL,MN",
- "ABC@\"DEF GHI\"@ JKL@,MN");
- doTest1(ce, "SQL #6", "ABC\"DEF GHI JKL", "ABC@\"DEF GHI JKL");
- doTest1(ce, "SQL #7", "ABC/*DEF GHI*/ JKL,MN",
- "ABC@/*DEF GHI@*/ JKL@,MN");
- doTest1(ce, "SQL #8.0", "ABC/*DEF GHI JKL", "ABC@/*DEF GHI JKL");
- doTest1(ce, "SQL #8.1", "MNO PQ*/RS,TUV", "MNO PQ@*/RS@,TUV");
- doTest1(ce, "SQL #9", "ABC--DEF GHI JKL", "ABC@--DEF GHI JKL");
- doTest1(ce, "SQL #10", "ABC--DEF--GHI,JKL", "ABC@--DEF--GHI,JKL");
- doTest1(ce, "SQL #11", "ABC'DEF '' G I' JKL,MN",
- "ABC@'DEF '' G I'@ JKL@,MN");
- doTest1(ce, "SQL #12", "ABC\"DEF \"\" G I\" JKL,MN",
- "ABC@\"DEF \"\" G I\"@ JKL@,MN");
- doTest1(ce, "SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.SYSTEM_USER);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "System #1", "HOST(JACK)", "HOST@(JACK)");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.UNDERSCORE);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.URL);
- assertNotNull(ce);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- doTest1(ce, "URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4",
- "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.XPATH);
- assertNotNull(ce);
- ce.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- doTest1(ce, "Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI");
- doTest1(ce, "Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK ");
- doTest1(ce, "Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK ");
- doTest1(ce, "Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK ");
-
- ce = StringProcessor.getProcessor(IBiDiProcessor.EMAIL);
- state = IComplExpProcessor.STATE_NOTHING_GOING;
- String operators = ce.getOperators();
- assertEquals("<>.:,;@", operators);
- ce.setOperators("+-*/");
- doTest1(ce, "DelimsEsc #1", "abc+DEF-GHI", "abc+DEF@-GHI");
- doTest1(ce, "DelimsEsc #2", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK ");
- doTest1(ce, "DelimsEsc #3", "DEF-GHI (A*B)/JK ", "DEF@-GHI @(A*B)@/JK ");
- doTest1(ce, "DelimsEsc #4", "DEF-GHI (A*B\\)*C) /JK ",
- "DEF@-GHI @(A*B\\)*C) @/JK ");
- doTest1(ce, "DelimsEsc #5", "DEF-GHI (A\\\\\\)*C) /JK ",
- "DEF@-GHI @(A\\\\\\)*C) @/JK ");
- doTest1(ce, "DelimsEsc #6", "DEF-GHI (A\\\\)*C /JK ",
- "DEF@-GHI @(A\\\\)@*C @/JK ");
- doTest1(ce, "DelimsEsc #7", "DEF-GHI (A\\)*C /JK ",
- "DEF@-GHI @(A\\)*C /JK ");
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/FullToLeanTest.java 17 Mar 2010 17:53:44 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-import org.eclipse.equinox.bidi.complexp.StringProcessor;
-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor;
-
-/**
- * Tests fullToLean method
- */
-
-public class FullToLeanTest extends ComplExpTestBase {
-
- private IComplExpProcessor processor;
-
- protected void setUp() throws Exception {
- super.setUp();
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- }
-
- static int[] getpos(IComplExpProcessor complexp, boolean leanToFull) {
- int[] pos = new int[5];
-
- if (leanToFull) {
- pos[0] = complexp.leanToFullPos(0);
- pos[1] = complexp.leanToFullPos(4);
- pos[2] = complexp.leanToFullPos(7);
- pos[3] = complexp.leanToFullPos(10);
- pos[4] = complexp.leanToFullPos(30);
- } else {
- pos[0] = complexp.fullToLeanPos(0);
- pos[1] = complexp.fullToLeanPos(4);
- pos[2] = complexp.fullToLeanPos(7);
- pos[3] = complexp.fullToLeanPos(10);
- pos[4] = complexp.fullToLeanPos(30);
- }
- return pos;
- }
-
- private void doTest1(String msg, String data, String leanLTR,
- String fullLTR, int[] l2fPosLTR, int[] f2lPosLTR, String leanRTL,
- String fullRTL, int[] l2fPosRTL, int[] f2lPosRTL) {
- String text, full, lean, label;
- int[] pos;
-
- text = toUT16(data);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- lean = processor.fullToLeanText(text);
- assertEquals(msg + "LTR lean", leanLTR, toPseudo(lean));
- full = processor.leanToFullText(lean);
- assertEquals(msg + "LTR full", fullLTR, toPseudo(full));
- pos = getpos(processor, true);
- label = msg + "leanToFullPos() LTR, expected="
- + array_display(l2fPosLTR) + " result=" + array_display(pos);
- assertTrue(label, arrays_equal(l2fPosLTR, pos));
- pos = getpos(processor, false);
- label = msg + "fullToLeanPos() LTR, expected="
- + array_display(f2lPosLTR) + " result=" + array_display(pos);
- assertTrue(label, arrays_equal(f2lPosLTR, pos));
- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL);
- lean = processor.fullToLeanText(text);
- assertEquals(msg + "RTL lean", leanRTL, toPseudo(lean));
- full = processor.leanToFullText(lean);
- assertEquals(msg + "RTL full", fullRTL, toPseudo(full));
- pos = getpos(processor, true);
- label = msg + "leanToFullPos() RTL, expected="
- + array_display(l2fPosRTL) + " result=" + array_display(pos);
- assertTrue(label, arrays_equal(l2fPosRTL, pos));
- pos = getpos(processor, false);
- label = msg + "fullToLeanPos() RTL, expected="
- + array_display(f2lPosRTL) + " result=" + array_display(pos);
- assertTrue(label, arrays_equal(f2lPosRTL, pos));
- }
-
- private void doTest2(String msg) {
- String text, data, full, lean, model;
- int state, state2, state3;
-
- processor = StringProcessor.getProcessor(IBiDiProcessor.SQL);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- data = "update \"AB_CDE\" set \"COL1\"@='01', \"COL2\"@='02' /* GH IJK";
- text = toUT16(data);
- lean = processor.fullToLeanText(text);
- state = processor.getFinalState();
- model = "update \"AB_CDE\" set \"COL1\"='01', \"COL2\"='02' /* GH IJK";
- assertEquals(msg + "LTR lean", model, toPseudo(lean));
- full = processor.leanToFullText(lean);
- assertEquals(msg + "LTR full", data, toPseudo(full));
- assertEquals(msg + "state from leanToFullText", processor
- .getFinalState(), state);
- data = "THIS IS A COMMENT LINE";
- text = toUT16(data);
- lean = processor.fullToLeanText(text, state);
- state2 = processor.getFinalState();
- model = "THIS IS A COMMENT LINE";
- assertEquals(msg + "LTR lean2", model, toPseudo(lean));
- full = processor.leanToFullText(lean, state);
- assertEquals(msg + "LTR full2", data, toPseudo(full));
- assertEquals(msg + "state from leanToFullText2", processor
- .getFinalState(), state2);
- data = "SOME MORE */ where \"COL3\"@=123";
- text = toUT16(data);
- lean = processor.fullToLeanText(text, state2);
- state3 = processor.getFinalState();
- model = "SOME MORE */ where \"COL3\"=123";
- assertEquals(msg + "LTR lean3", model, toPseudo(lean));
- full = processor.leanToFullText(lean, state2);
- assertEquals(msg + "LTR full3", data, toPseudo(full));
- assertEquals(msg + "state from leanToFullText3", processor
- .getFinalState(), state3);
- }
-
- public void testFullToLean() {
-
- doTest1("testFullToLean #1 - ", "", "", "",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 0, 0, 0, 0 }, "",
- "", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 0, 0, 0, 0 });
- doTest1("testFullToLean #01 - ", "1.abc", "1.abc", "1.abc", new int[] {
- 0, 4, 7, 10, 30 }, new int[] { 0, 4, 5, 5, 5 }, "1.abc",
- ">@1.abc@^", new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2,
- 5, 5, 5 });
- doTest1("testFullToLean #02 - ", "2.abc,def", "2.abc,def", "2.abc,def",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 7, 9, 9 },
- "2.abc,def", ">@2.abc,def@^", new int[] { 2, 6, 9, 12, 32 },
- new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #03 - ", "@a.3.bc,def", "a.3.bc,def",
- "a.3.bc,def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 10, 10 }, "a.3.bc,def", ">@a.3.bc,def@^", new int[] {
- 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 10 });
- doTest1("testFullToLean #04 - ", "@@a.4.bc,def", "a.4.bc,def",
- "a.4.bc,def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 10, 10 }, "a.4.bc,def", ">@a.4.bc,def@^", new int[] {
- 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 10 });
- doTest1("testFullToLean #05 - ", "@5.abc,def", "5.abc,def",
- "5.abc,def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 9, 9 }, "5.abc,def", ">@5.abc,def@^", new int[] { 2,
- 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #06 - ", "@@6.abc,def", "6.abc,def",
- "6.abc,def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 9, 9 }, "6.abc,def", ">@6.abc,def@^", new int[] { 2,
- 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #07 - ", "7abc,@def", "7abc,@def", "7abc,@def",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 7, 9, 9 },
- "7abc,@def", ">@7abc,@def@^", new int[] { 2, 6, 9, 12, 32 },
- new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #08 - ", "8abc,@@def", "8abc,@def",
- "8abc,@def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 9, 9 }, "8abc,@def", ">@8abc,@def@^", new int[] { 2,
- 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #09 - ", "9abc,def@", "9abc,def", "9abc,def",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 7, 8, 8 },
- "9abc,def", ">@9abc,def@^", new int[] { 2, 6, 9, 12, 32 },
- new int[] { 0, 2, 5, 8, 8 });
- doTest1("testFullToLean #10 - ", "10abc,def@@", "10abc,def",
- "10abc,def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 9, 9 }, "10abc,def", ">@10abc,def@^", new int[] { 2,
- 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #11 - ", "@a.11.bc,@def@", "a.11.bc,@def",
- "a.11.bc,@def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0,
- 4, 7, 10, 12 }, "a.11.bc,@def", ">@a.11.bc,@def@^",
- new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 12 });
- doTest1("testFullToLean #12 - ", "@@a.12.bc,@@def@@", "a.12.bc,@def",
- "a.12.bc,@def", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0,
- 4, 7, 10, 12 }, "a.12.bc,@def", ">@a.12.bc,@def@^",
- new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 12 });
- doTest1("testFullToLean #13 - ", "13ABC", "13ABC", "13ABC", new int[] {
- 0, 4, 7, 10, 30 }, new int[] { 0, 4, 5, 5, 5 }, "13ABC",
- ">@13ABC@^", new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2,
- 5, 5, 5 });
- doTest1("testFullToLean #14 - ", "14ABC,DE", "14ABC,DE", "14ABC@,DE",
- new int[] { 0, 4, 8, 11, 31 }, new int[] { 0, 4, 6, 8, 8 },
- "14ABC,DE", ">@14ABC@,DE@^", new int[] { 2, 6, 10, 13, 33 },
- new int[] { 0, 2, 5, 7, 8 });
- doTest1("testFullToLean #15 - ", "15ABC@,DE", "15ABC,DE", "15ABC@,DE",
- new int[] { 0, 4, 8, 11, 31 }, new int[] { 0, 4, 6, 8, 8 },
- "15ABC,DE", ">@15ABC@,DE@^", new int[] { 2, 6, 10, 13, 33 },
- new int[] { 0, 2, 5, 7, 8 });
- doTest1("testFullToLean #16 - ", "16ABC@@,DE", "16ABC,DE", "16ABC@,DE",
- new int[] { 0, 4, 8, 11, 31 }, new int[] { 0, 4, 6, 8, 8 },
- "16ABC,DE", ">@16ABC@,DE@^", new int[] { 2, 6, 10, 13, 33 },
- new int[] { 0, 2, 5, 7, 8 });
- doTest1("testFullToLean #17 - ", "17ABC,@@DE", "17ABC,@DE",
- "17ABC,@DE", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 9, 9 }, "17ABC,@DE", ">@17ABC,@DE@^", new int[] { 2,
- 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 9 });
- doTest1("testFullToLean #18 - ", "18ABC,DE,FGH", "18ABC,DE,FGH",
- "18ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "18ABC,DE,FGH", ">@18ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #19 - ", "19ABC@,DE@,FGH", "19ABC,DE,FGH",
- "19ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "19ABC,DE,FGH", ">@19ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #20 - ", "20ABC,@DE,@FGH", "20ABC,@DE,@FGH",
- "20ABC,@DE,@FGH", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0,
- 4, 7, 10, 14 }, "20ABC,@DE,@FGH", ">@20ABC,@DE,@FGH@^",
- new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 14 });
- doTest1("testFullToLean #21 - ", "21ABC@@,DE@@,FGH", "21ABC,DE,FGH",
- "21ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "21ABC,DE,FGH", ">@21ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #22 - ", "22ABC,@@DE,@@FGH", "22ABC,@DE,@FGH",
- "22ABC,@DE,@FGH", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0,
- 4, 7, 10, 14 }, "22ABC,@DE,@FGH", ">@22ABC,@DE,@FGH@^",
- new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 14 });
- doTest1("testFullToLean #23 - ", ">@23abc@^", "23abc", "23abc",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 5, 5, 5 },
- "23abc", ">@23abc@^", new int[] { 2, 6, 9, 12, 32 }, new int[] {
- 0, 2, 5, 5, 5 });
- doTest1("testFullToLean #24 - ", "24abc@^", "24abc", "24abc",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 5, 5, 5 },
- "24abc", ">@24abc@^", new int[] { 2, 6, 9, 12, 32 }, new int[] {
- 0, 2, 5, 5, 5 });
- doTest1("testFullToLean #25 - ", ">@25abc", "25abc", "25abc",
- new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 5, 5, 5 },
- "25abc", ">@25abc@^", new int[] { 2, 6, 9, 12, 32 }, new int[] {
- 0, 2, 5, 5, 5 });
- doTest1("testFullToLean #26 - ", "26AB,CD@EF,GHI", "26AB,CD@EF,GHI",
- "26AB@,CD@EF@,GHI", new int[] { 0, 5, 8, 12, 32 }, new int[] {
- 0, 4, 6, 9, 14 }, "26AB,CD@EF,GHI",
- ">@26AB@,CD@EF@,GHI@^", new int[] { 2, 7, 10, 14, 34 },
- new int[] { 0, 2, 4, 7, 14 });
- doTest1("testFullToLean #27 - ", "27AB,CD@123ef,GHI",
- "27AB,CD@123ef,GHI", "27AB@,CD@123ef,GHI", new int[] { 0, 5, 8,
- 11, 31 }, new int[] { 0, 4, 6, 9, 17 },
- "27AB,CD@123ef,GHI", ">@27AB@,CD@123ef,GHI@^", new int[] { 2,
- 7, 10, 13, 33 }, new int[] { 0, 2, 4, 7, 17 });
- doTest1("testFullToLean #28 - ", ">28ABC@,DE@,FGH^", "28ABC,DE,FGH",
- "28ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "28ABC,DE,FGH", ">@28ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #29 - ", ">>29ABC@,DE@,FGH^^", "29ABC,DE,FGH",
- "29ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "29ABC,DE,FGH", ">@29ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #30 - ", ">30AB>C^@,DE@,FGH^",
- "30AB>C^,DE,FGH", "30AB>C^@,DE@,FGH", new int[] { 0, 4, 8, 12,
- 32 }, new int[] { 0, 4, 7, 9, 14 }, "30AB>C^,DE,FGH",
- ">@30AB>C^@,DE@,FGH@^", new int[] { 2, 6, 10, 14, 34 },
- new int[] { 0, 2, 5, 7, 14 });
- doTest1("testFullToLean #31 - ", ">31AB>C@,DE@,FGH^^", "31AB>C,DE,FGH",
- "31AB>C@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] {
- 0, 4, 6, 9, 13 }, "31AB>C,DE,FGH",
- ">@31AB>C@,DE@,FGH@^", new int[] { 2, 6, 10, 14, 34 },
- new int[] { 0, 2, 5, 7, 13 });
- doTest1("testFullToLean #32 - ", ">@32ABC@,DE@,FGH@^", "32ABC,DE,FGH",
- "32ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "32ABC,DE,FGH", ">@32ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #33 - ", "@33ABC@,DE@,FGH@^", "33ABC,DE,FGH",
- "33ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "33ABC,DE,FGH", ">@33ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #34 - ", ">@34ABC@,DE@,FGH@", "34ABC,DE,FGH",
- "34ABC@,DE@,FGH", new int[] { 0, 4, 8, 12, 32 }, new int[] { 0,
- 4, 6, 8, 12 }, "34ABC,DE,FGH", ">@34ABC@,DE@,FGH@^",
- new int[] { 2, 6, 10, 14, 34 }, new int[] { 0, 2, 5, 7, 12 });
- doTest1("testFullToLean #35 - ", "35ABC@@DE@@@GH@", "35ABC@DE@GH",
- "35ABC@DE@GH", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4,
- 7, 10, 11 }, "35ABC@DE@GH", ">@35ABC@DE@GH@^",
- new int[] { 2, 6, 9, 12, 32 }, new int[] { 0, 2, 5, 8, 11 });
- doTest1("testFullToLean #36 - ", "36ABC@@DE@@@@@@", "36ABC@DE",
- "36ABC@DE", new int[] { 0, 4, 7, 10, 30 }, new int[] { 0, 4, 7,
- 8, 8 }, "36ABC@DE", ">@36ABC@DE@^", new int[] { 2, 6,
- 9, 12, 32 }, new int[] { 0, 2, 5, 8, 8 });
- doTest1("testFullToLean #37 - ", ">>>@@@@@^^^", "", "", new int[] { 0,
- 4, 7, 10, 30 }, new int[] { 0, 0, 0, 0, 0 }, "", "", new int[] {
- 0, 4, 7, 10, 30 }, new int[] { 0, 0, 0, 0, 0 });
-
- // test fullToLeanText with initial state
- doTest2("testFullToLean #38 - ");
- }
-}
Index: src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java
diff -N src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java
--- src/org/eclipse/equinox/bidi/internal/tests/MethodsTest.java 17 Mar 2010 17:53:44 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.internal.tests;
-
-import org.eclipse.equinox.bidi.complexp.IComplExpProcessor;
-import org.eclipse.equinox.bidi.complexp.IBiDiProcessor;
-import org.eclipse.equinox.bidi.complexp.StringProcessor;
-import org.eclipse.equinox.bidi.complexp.ComplExpUtil;
-
-/**
- * Tests most public methods of ComplExpBasic
- */
-
-public class MethodsTest extends ComplExpTestBase {
-
- final static int LTR = IComplExpProcessor.DIRECTION_LTR;
- final static int RTL = IComplExpProcessor.DIRECTION_RTL;
-
- IComplExpProcessor processor;
-
- private void doTestTools() {
-
- // This method tests utility methods used by the JUnits
- String data = "56789ABCDEFGHIJKLMNOPQRSTUVWXYZ~#@&><^|`";
- String text = toUT16(data);
- String dat2 = toPseudo(text);
- assertEquals(data, dat2);
-
- text = toPseudo(data);
- assertEquals("56789abcdefghijklmnopqrstuvwxyz~#@&><^|`", text);
-
- int[] arA = new int[] { 1, 2 };
- int[] arB = new int[] { 3, 4, 5 };
- assertFalse(arrays_equal(arA, arB));
-
- assertTrue(arrays_equal(arA, arA));
-
- arB = new int[] { 3, 4 };
- assertFalse(arrays_equal(arA, arB));
-
- int[][] ar2A = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 3 } };
- int[][] ar2B = new int[][] { { 1 }, { 1, 2 } };
- assertTrue(arrays2_equal(ar2A, ar2A));
-
- assertFalse(arrays2_equal(ar2A, ar2B));
-
- ar2B = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 3, 4 } };
- assertFalse(arrays2_equal(ar2A, ar2B));
-
- ar2B = new int[][] { { 1 }, { 1, 2 }, { 1, 2, 4 } };
- assertFalse(arrays2_equal(ar2A, ar2B));
-
- text = array_display(null);
- assertEquals("null", text);
-
- text = array2_display(null);
- assertEquals("null", text);
- }
-
- private void doTestState() {
- String data, lean, full, model;
- int state;
-
- data = "A=B+C;/* D=E+F;";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "A@=B@+C@;/* D=E+F;";
- assertEquals("full1", model, toPseudo(full));
- state = processor.getFinalState();
- data = "A=B+C; D=E+F;";
- lean = toUT16(data);
- full = processor.leanToFullText(lean, state);
- model = "A=B+C; D=E+F;";
- assertEquals("full2", model, toPseudo(full));
- state = processor.getFinalState();
- data = "A=B+C;*/ D=E+F;";
- lean = toUT16(data);
- full = processor.leanToFullText(lean, state);
- model = "A=B+C;*/@ D@=E@+F;";
- assertEquals("full3", model, toPseudo(full));
- }
-
- private void doTestOrientation() {
- int orient;
-
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- orient = processor.recallOrientation();
- // TBD: the following test cannot succeed with the current
- // implementation.
- // it will need allocating separate data for each processor use.
- // assertEquals("orient #1", IComplExpProcessor.ORIENT_LTR, orient);
-
- processor.assumeOrientation(IComplExpProcessor.ORIENT_IGNORE);
- orient = processor.recallOrientation();
- assertEquals("orient #2", IComplExpProcessor.ORIENT_IGNORE, orient);
-
- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL);
- orient = processor.recallOrientation();
- processor.leanToFullText("--!**");
- assertEquals("orient #3", IComplExpProcessor.ORIENT_CONTEXTUAL_RTL,
- orient);
-
- processor.assumeOrientation(9999);
- orient = processor.recallOrientation();
- processor.leanToFullText("--!**");
- assertEquals("orient #4", IComplExpProcessor.ORIENT_UNKNOWN, orient);
- }
-
- private void doTestOrient(String label, String data, String resLTR,
- String resRTL, String resCon) {
- String full, lean;
-
- lean = toUT16(data);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- full = processor.leanToFullText(lean);
- assertEquals(label + "LTR full", resLTR, toPseudo(full));
- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL);
- full = processor.leanToFullText(lean);
- assertEquals("label + RTL full", resRTL, toPseudo(full));
- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_RTL);
- full = processor.leanToFullText(lean);
- assertEquals(label + "CON full", resCon, toPseudo(full));
- }
-
- private void doTestScripts() {
- boolean flag;
- flag = processor.handlesArabicScript();
- assertTrue("Handles Arabic 1", flag);
- flag = processor.handlesHebrewScript();
- assertTrue("Handles Hebrew 1", flag);
-
- processor.selectBidiScript(false, false);
- flag = processor.handlesArabicScript();
- assertFalse("Handles Arabic 2", flag);
- flag = processor.handlesHebrewScript();
- assertFalse("Handles Hebrew 2", flag);
- doTestOrient("Scripts #1 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^", "@BCD,EF");
- processor.selectBidiScript(true, false);
- flag = processor.handlesArabicScript();
- assertTrue("Handles Arabic 3", flag);
- flag = processor.handlesHebrewScript();
- assertFalse("Handles Hebrew 3", flag);
- doTestOrient("Scripts #2 ", "d,EF", "d,EF", ">@d,EF@^", "d,EF");
- doTestOrient("Scripts #3 ", "#,eF", "#,eF", ">@#,eF@^", "@#,eF");
- doTestOrient("Scripts #4 ", "#,12", "#@,12", ">@#@,12@^", "@#@,12");
- doTestOrient("Scripts #5 ", "#,##", "#@,##", ">@#@,##@^", "@#@,##");
- doTestOrient("Scripts #6 ", "#,89", "#@,89", ">@#@,89@^", "@#@,89");
- doTestOrient("Scripts #7 ", "#,ef", "#,ef", ">@#,ef@^", "@#,ef");
- doTestOrient("Scripts #8 ", "#,", "#,", ">@#,@^", "@#,");
- doTestOrient("Scripts #9 ", "9,ef", "9,ef", ">@9,ef@^", "9,ef");
- doTestOrient("Scripts #10 ", "9,##", "9@,##", ">@9@,##@^", "9@,##");
- doTestOrient("Scripts #11 ", "7,89", "7@,89", ">@7@,89@^", "7@,89");
- doTestOrient("Scripts #12 ", "7,EF", "7,EF", ">@7,EF@^", "@7,EF");
- doTestOrient("Scripts #13 ", "BCD,EF", "BCD,EF", ">@BCD,EF@^",
- "@BCD,EF");
-
- processor.selectBidiScript(false, true);
- flag = processor.handlesArabicScript();
- assertFalse("Handles Arabic 4", flag);
- flag = processor.handlesHebrewScript();
- assertTrue("Handles Hebrew 4", flag);
- doTestOrient("Scripts #14 ", "BCd,EF", "BCd,EF", ">@BCd,EF@^",
- "@BCd,EF");
- doTestOrient("Scripts #15 ", "BCD,eF", "BCD,eF", ">@BCD,eF@^",
- "@BCD,eF");
- doTestOrient("Scripts #16 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^",
- "@BCD@,EF");
- doTestOrient("Scripts #17 ", "BCD,12", "BCD@,12", ">@BCD@,12@^",
- "@BCD@,12");
- doTestOrient("Scripts #18 ", "BCD,", "BCD,", ">@BCD,@^", "@BCD,");
-
- processor.selectBidiScript(true, true);
- doTestOrient("Scripts #19 ", "123,45|67", "123,45|67", ">@123,45|67@^",
- "@123,45|67");
- doTestOrient("Scripts #20 ", "5,e", "5,e", ">@5,e@^", "5,e");
- doTestOrient("Scripts #21 ", "5,#", "5@,#", ">@5@,#@^", "5@,#");
- doTestOrient("Scripts #22 ", "5,6", "5@,6", ">@5@,6@^", "5@,6");
- doTestOrient("Scripts #23 ", "5,D", "5@,D", ">@5@,D@^", "5@,D");
- doTestOrient("Scripts #24 ", "5,--", "5,--", ">@5,--@^", "@5,--");
- }
-
- private void doTestLeanOffsets() {
- String lean, data, label;
- int state;
- int[] offsets;
- int[] model;
-
- data = "A=B+C;/* D=E+F;";
- lean = toUT16(data);
- offsets = processor.leanBidiCharOffsets(lean);
- model = new int[] { 1, 3, 5 };
- label = "leanBidiCharOffsets() #1 expected=" + array_display(model)
- + " result=" + array_display(offsets);
- assertTrue(label, arrays_equal(model, offsets));
- state = processor.getFinalState();
- data = "A=B+C;*/ D=E+F;";
- lean = toUT16(data);
- offsets = processor.leanBidiCharOffsets(lean, state);
- model = new int[] { 8, 10, 12 };
- label = "leanBidiCharOffsets() #2 expected=" + array_display(model)
- + " result=" + array_display(offsets);
- assertTrue(label, arrays_equal(model, offsets));
- offsets = processor.leanBidiCharOffsets();
- model = new int[] { 8, 10, 12 };
- label = "leanBidiCharOffsets() #3 expected=" + array_display(model)
- + " result=" + array_display(offsets);
- assertTrue(label, arrays_equal(model, offsets));
- }
-
- private void doTestFullOffsets(String label, String data, int[] resLTR,
- int[] resRTL, int[] resCon) {
- String full, lean, msg;
- int[] offsets;
-
- lean = toUT16(data);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- full = processor.leanToFullText(lean);
- // the following line avoids a compiler warning about full never being
- // read
- full += "";
- offsets = processor.fullBidiCharOffsets();
- msg = label + "LTR expected=" + array_display(resLTR) + " result="
- + array_display(offsets);
- assertTrue(msg, arrays_equal(resLTR, offsets));
- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL);
- full = processor.leanToFullText(lean);
- offsets = processor.fullBidiCharOffsets();
- msg = label + "RTL expected=" + array_display(resRTL) + " result="
- + array_display(offsets);
- assertTrue(msg, arrays_equal(resRTL, offsets));
- processor.assumeOrientation(IComplExpProcessor.ORIENT_CONTEXTUAL_LTR);
- full = processor.leanToFullText(lean);
- offsets = processor.fullBidiCharOffsets();
- msg = label + "CON expected=" + array_display(resCon) + " result="
- + array_display(offsets);
- assertTrue(msg, arrays_equal(resCon, offsets));
- }
-
- private void doTestMirrored() {
- boolean mirrored;
-
- mirrored = ComplExpUtil.isMirroredDefault();
- assertFalse("mirrored #1", mirrored);
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- mirrored = processor.isMirrored();
- assertFalse("mirrored #2", mirrored);
- ComplExpUtil.assumeMirroredDefault(true);
- mirrored = ComplExpUtil.isMirroredDefault();
- assertTrue("mirrored #3", mirrored);
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- mirrored = processor.isMirrored();
- // TBD: the following test cannot succeed with the current
- // implementation.
- // it will need allocating separate data for each processor use.
- // assertTrue("mirrored #4", mirrored);
- processor.assumeMirrored(false);
- mirrored = processor.isMirrored();
- assertFalse("mirrored #5", mirrored);
- }
-
- private void doTestDirection() {
- int[][] dir;
- int[][] modir;
- String data, lean, full, model, msg;
-
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- dir = processor.getDirection();
- modir = new int[][] { { LTR, LTR }, { LTR, LTR } };
- msg = "TestDirection #1 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setDirection(RTL);
- dir = processor.getDirection();
- modir = new int[][] { { RTL, RTL }, { RTL, RTL } };
- msg = "TestDirection #2 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setDirection(LTR, RTL);
- dir = processor.getDirection();
- modir = new int[][] { { LTR, RTL }, { LTR, RTL } };
- msg = "TestDirection #3 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setArabicDirection(RTL);
- dir = processor.getDirection();
- modir = new int[][] { { RTL, RTL }, { LTR, RTL } };
- msg = "TestDirection #4 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setArabicDirection(RTL, LTR);
- dir = processor.getDirection();
- modir = new int[][] { { RTL, LTR }, { LTR, RTL } };
- msg = "TestDirection #5 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setHebrewDirection(RTL);
- dir = processor.getDirection();
- modir = new int[][] { { RTL, LTR }, { RTL, RTL } };
- msg = "TestDirection #6 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor.setHebrewDirection(RTL, LTR);
- dir = processor.getDirection();
- modir = new int[][] { { RTL, LTR }, { RTL, LTR } };
- msg = "TestDirection #7 expected=" + array2_display(modir) + " result="
- + array2_display(dir);
- assertTrue(msg, arrays2_equal(modir, dir));
-
- processor = StringProcessor.getProcessor(IBiDiProcessor.EMAIL);
- processor.assumeMirrored(false);
- processor.setArabicDirection(LTR, RTL);
- processor.setHebrewDirection(LTR, LTR);
- data = "#ABC.#DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "#ABC@.#DEF@:HOST.com";
- assertEquals("TestDirection #9 full", model, toPseudo(full));
-
- data = "ABC.DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "ABC@.DEF@:HOST.com";
- assertEquals("TestDirection #10 full", model, toPseudo(full));
-
- processor.assumeMirrored(true);
- data = "#ABC.#DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "<ABC.#DEF:HOST.com&^";
- assertEquals("TestDirection #11 full", model, toPseudo(full));
-
- data = "#ABc.#DEF:HOSt.COM";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "<ABc.#DEF:HOSt.COM&^";
- assertEquals("TestDirection #12 full", model, toPseudo(full));
-
- data = "#ABc.#DEF:HOSt.";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "<ABc.#DEF:HOSt.&^";
- assertEquals("TestDirection #13 full", model, toPseudo(full));
-
- data = "ABC.DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "ABC@.DEF@:HOST.com";
- assertEquals("TestDirection #14 full", model, toPseudo(full));
-
- data = "--.---:----";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "--.---:----";
- assertEquals("TestDirection #15 full", model, toPseudo(full));
-
- data = "ABC.|DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "ABC.|DEF@:HOST.com";
- assertEquals("TestDirection #16 full", model, toPseudo(full));
-
- processor.assumeOrientation(IComplExpProcessor.ORIENT_RTL);
- data = "#ABc.|#DEF:HOST.com";
- lean = toUT16(data);
- full = processor.leanToFullText(lean);
- model = "#ABc.|#DEF:HOST.com";
- assertEquals("TestDirection #17 full", model, toPseudo(full));
- }
-
- public void testMethods() {
-
- doTestTools();
-
- processor = StringProcessor.getProcessor(IBiDiProcessor.JAVA);
- doTestState();
-
- doTestOrientation();
-
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- doTestOrient("Methods #1 ", "", "", "", "");
- doTestOrient("Methods #2 ", "abc", "abc", ">@abc@^", "abc");
- doTestOrient("Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC");
- doTestOrient("Methods #4 ", "bcd,ef", "bcd,ef", ">@bcd,ef@^", "bcd,ef");
- doTestOrient("Methods #5 ", "BCD,EF", "BCD@,EF", ">@BCD@,EF@^",
- "@BCD@,EF");
- doTestOrient("Methods #6 ", "cde,FG", "cde,FG", ">@cde,FG@^", "cde,FG");
- doTestOrient("Methods #7 ", "CDE,fg", "CDE,fg", ">@CDE,fg@^", "@CDE,fg");
- doTestOrient("Methods #8 ", "12..def,GH", "12..def,GH",
- ">@12..def,GH@^", "12..def,GH");
- doTestOrient("Methods #9 ", "34..DEF,gh", "34..DEF,gh",
- ">@34..DEF,gh@^", "@34..DEF,gh");
-
- doTestScripts();
-
- processor = StringProcessor.getProcessor(IBiDiProcessor.JAVA);
- doTestLeanOffsets();
-
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- doTestFullOffsets("TestFullOffsets ", "BCD,EF,G", new int[] { 3, 7 },
- new int[] { 0, 1, 5, 9, 12, 13 }, new int[] { 0, 4, 8 });
-
- doTestMirrored();
-
- doTestDirection();
-
- processor = StringProcessor
- .getProcessor(IBiDiProcessor.COMMA_DELIMITED);
- processor.assumeOrientation(IComplExpProcessor.ORIENT_LTR);
- processor.setDirection(LTR);
- String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
- String lean = toUT16(data);
- String full = processor.leanToFullText(lean);
- String model = "A@,B@,C@,D@,E@,F@,G@,H@,I@,J@,K@,L@,M@,N@,O@,P@,Q@,R@,S@,T@,U@,V@,W@,X@,Y@,Z";
- assertEquals("many inserts", model, toPseudo(full));
-
- }
-}
Index: src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java
diff -N src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java
--- src/org/eclipse/equinox/bidi/tests/BiDiTestSuite.java 17 Mar 2010 17:53:43 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.bidi.tests;
-
-import org.eclipse.equinox.bidi.internal.tests.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class BiDiTestSuite extends TestSuite {
- public static Test suite() {
- return new BiDiTestSuite();
- }
-
- public BiDiTestSuite() {
- addTestSuite(ExtensibilityTest.class);
- addTestSuite(MethodsTest.class);
- // addTestSuite(TestDoNothing.class);
- addTestSuite(FullToLeanTest.class);
- addTestSuite(ComplExpMathTest.class);
- // TBD: TestSubclass
- addTestSuite(ExtensionsTest.class);
- addTestSuite(ComplExpUtilTest.class);
- }
-}
Index: src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java
===================================================================
RCS file: src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java
diff -N src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/equinox/bidi/tests/BidiComplexTestSuite.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.bidi.tests;
+
+import org.eclipse.equinox.bidi.internal.tests.*;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class BidiComplexTestSuite extends TestSuite {
+ public static Test suite() {
+ return new BidiComplexTestSuite();
+ }
+
+ public BidiComplexTestSuite() {
+ addTestSuite(BidiComplexExtensibilityTest.class);
+ addTestSuite(BidiComplexMethodsTest.class);
+ addTestSuite(BidiComplexNullProcessorTest.class);
+ addTestSuite(BidiComplexFullToLeanTest.class);
+ addTestSuite(BidiComplexExtensionsTest.class);
+ addTestSuite(BidiComplexMathTest.class);
+ addTestSuite(BidiComplexSomeMoreTest.class);
+ addTestSuite(BidiComplexUtilTest.class);
+ }
+}
\ No newline at end of file