<commit_before>/***********************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * 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:
 * Actuate Corporation - initial API and implementation
 ***********************************************************************/

package org.eclipse.birt.chart.tests.engine.internal;

import java.util.Date;

import junit.framework.TestCase;

import org.eclipse.birt.chart.internal.factory.TupleComparator;

import com.ibm.icu.util.Calendar;

/**
 * Test class for checking the correctness of compareObjects() method 
 * in TupleComparator.java class.
 */

public class TupleComparatorTest extends TestCase {

	public void testCompareObjects() {

		assertEquals(0, TupleComparator.compareObjects(null, null) );
		assertEquals(-1, TupleComparator.compareObjects(null, "abc") ); //$NON-NLS-1$
		assertEquals(1, TupleComparator.compareObjects("abc", null) ); //$NON-NLS-1$
		
		assertEquals(1, TupleComparator.compareObjects("abc", "a") ); //$NON-NLS-1$ //$NON-NLS-2$
		assertEquals(-1, TupleComparator.compareObjects("ab", "b") ); //$NON-NLS-1$ //$NON-NLS-2$
		assertEquals(0, TupleComparator.compareObjects("abc", "abc") ); //$NON-NLS-1$ //$NON-NLS-2$
		
		Integer n1 = new Integer(80);
		Integer n2 = new Integer(60);
		assertEquals(1, TupleComparator.compareObjects(n1, n2) );
		assertEquals(-1, TupleComparator.compareObjects(n2, n1) );
		
		Date a = new Date((long)8E8);
		Date b = new Date((long)7E9);	
		assertEquals(-1, TupleComparator.compareObjects(a, b) );
		assertEquals(1, TupleComparator.compareObjects(b, a) );
		
        Calendar c1 = Calendar.getInstance();
        c1.set(1999,2,5);
        Calendar c2 = Calendar.getInstance();
        c2.set(2000,1,23);
		assertEquals(-1, TupleComparator.compareObjects(c1, c2) );
		assertEquals(1, TupleComparator.compareObjects(c2, c1) );
	}
}<commit_msg>- Summary: fix bug134192:Thai3.2: Thai data sorting does not work in the BIRT chart. - Bugzilla Bug (s) Resolved: 134192 - Description: Change to use icu Collator to sort localed strings. - Tests Description  : Manual test - Files Edited:<commit_after>/***********************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * 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:
 * Actuate Corporation - initial API and implementation
 ***********************************************************************/

package org.eclipse.birt.chart.tests.engine.internal;

import java.util.Date;

import junit.framework.TestCase;

import org.eclipse.birt.chart.internal.factory.TupleComparator;

import com.ibm.icu.util.Calendar;

/**
 * Test class for checking the correctness of compareObjects() method 
 * in TupleComparator.java class.
 */

public class TupleComparatorTest extends TestCase {

	public void testCompareObjects() {

		assertEquals(0, TupleComparator.compareObjects(null, null, null) );
		assertEquals(-1, TupleComparator.compareObjects(null, "abc", null) ); //$NON-NLS-1$
		assertEquals(1, TupleComparator.compareObjects("abc", null, null) ); //$NON-NLS-1$
		
		assertEquals(1, TupleComparator.compareObjects("abc", "a", null) ); //$NON-NLS-1$ //$NON-NLS-2$
		assertEquals(-1, TupleComparator.compareObjects("ab", "b", null) ); //$NON-NLS-1$ //$NON-NLS-2$
		assertEquals(0, TupleComparator.compareObjects("abc", "abc", null) ); //$NON-NLS-1$ //$NON-NLS-2$
		
		Integer n1 = new Integer(80);
		Integer n2 = new Integer(60);
		assertEquals(1, TupleComparator.compareObjects(n1, n2, null) );
		assertEquals(-1, TupleComparator.compareObjects(n2, n1, null) );
		
		Date a = new Date((long)8E8);
		Date b = new Date((long)7E9);	
		assertEquals(-1, TupleComparator.compareObjects(a, b, null) );
		assertEquals(1, TupleComparator.compareObjects(b, a, null) );
		
        Calendar c1 = Calendar.getInstance();
        c1.set(1999,2,5);
        Calendar c2 = Calendar.getInstance();
        c2.set(2000,1,23);
		assertEquals(-1, TupleComparator.compareObjects(c1, c2, null) );
		assertEquals(1, TupleComparator.compareObjects(c2, c1, null) );
	}
}
{'fraction_non_alphanumeric': 0.1930835734870317, 'fraction_numerical': 0.031035247173575704, 'mean_word_length': 4.6612296110414055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4363193', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1368, 'n_words': 328}