PageRenderTime 46ms CodeModel.GetById 38ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tst/org/diffkit/diff/engine/tst/TestTableModel.groovy

http://diffkit.googlecode.com/
Groovy | 45 lines | 18 code | 9 blank | 18 comment | 2 complexity | 48c2b66e0f0437afebc1022a29b51f65 MD5 | raw file
 1/**
 2 * Copyright 2010-2011 Joseph Panico
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 *   http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.diffkit.diff.engine.tst
17
18
19
20import org.diffkit.diff.engine.DKColumnModel;
21import org.diffkit.diff.engine.DKTableModel 
22
23import groovy.util.GroovyTestCase;
24
25
26/**
27 * @author jpanico
28 */
29public class TestTableModel extends GroovyTestCase {
30	
31	public void testKeyValues(){
32		DKColumnModel column1_1 = [0, 'column1_1', DKColumnModel.Type.STRING]
33		DKColumnModel column1_2 = [1, 'column1_2', DKColumnModel.Type.STRING]
34		DKColumnModel column1_3 = [2, 'column1_3', DKColumnModel.Type.INTEGER]
35		DKColumnModel[] columns = [column1_1, column1_2, column1_3]
36		int[] key = [0,2]
37		DKTableModel lhsTable = ["lhs_table",columns, key]
38		println "column1_1->$column1_1"
39		println "lhsTable->$lhsTable"
40		
41		assert lhsTable.getKeyValues((Object[])['zzzz', 'aaaa', 1]) == ['zzzz',1]
42		assert lhsTable.getKeyValues((Object[])['zzzz', 'zzzz', 2]) == ['zzzz',2]
43	}
44	
45}