[luavsq] BPListの検索結果を格納するデータオブジェクトを移植; テストで読み込むファイルをluavsq.luaに変更
@@ -1,6 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../PhoneticSymbol.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
4 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
5 | 3 | |
6 | 4 | function testIsConsonant() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../TextStream.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testConstruct() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Timesig.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testConstructor() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../BP.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testConstruct() |
@@ -1,10 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../ArticulationType.lua" ); | |
4 | -dofile( "../NoteHeadHandle.lua" ); | |
5 | -dofile( "../IconParameter.lua" ); | |
6 | -dofile( "../Handle.lua" ); | |
7 | -dofile( "../HandleType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
8 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
9 | 3 | |
10 | 4 | function testConstruct() |
@@ -1,7 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../IconHandle.lua" ); | |
3 | -dofile( "../Handle.lua" ); | |
4 | -dofile( "../HandleType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
5 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
6 | 3 | |
7 | 4 | function getIconHandle() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../PlayMode.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function test() |
@@ -0,0 +1,3 @@ | ||
1 | +require( "lunit" ); | |
2 | +os.execute( "cd ../tool && make > /dev/null" ); | |
3 | +dofile( "../tool/luavsq.lua" ); |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../DynamicsMode.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function test() |
@@ -1,6 +1,5 @@ | ||
1 | -require( "lunit" ) | |
2 | -dofile( "../Util.lua" ) | |
3 | -module( "enhanced", package.seeall, lunit.testcase ) | |
1 | +dofile( "./test_bootstrap.lua" ); | |
2 | +module( "enhanced", package.seeall, lunit.testcase ); | |
4 | 3 | |
5 | 4 | function testSplit() |
6 | 5 | local value = "\t\tfoo\t\tbar" |
@@ -1,8 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../EventList.lua" ); | |
3 | -dofile( "../Event.lua" ); | |
4 | -dofile( "../ID.lua" ); | |
5 | -dofile( "../IDType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
6 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
7 | 3 | |
8 | 4 | function testConstruct() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../NRPN.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testGetVoiceChangeParameterID() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../TempoTableEntry.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testConstructor() |
@@ -1,17 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Event.lua" ); | |
3 | -dofile( "../IDType.lua" ); | |
4 | -dofile( "../ID.lua" ); | |
5 | -dofile( "../Util.lua" ); | |
6 | -dofile( "../TextStream.lua" ); | |
7 | -dofile( "../LyricHandle.lua" ); | |
8 | -dofile( "../ArticulationType.lua" ); | |
9 | -dofile( "../Lyric.lua" ); | |
10 | -dofile( "../VibratoHandle.lua" ); | |
11 | -dofile( "../IconParameter.lua" ); | |
12 | -dofile( "../VibratoBPList.lua" ); | |
13 | -dofile( "../NoteHeadHandle.lua" ); | |
14 | -dofile( "../IconHandle.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
15 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
16 | 3 | |
17 | 4 | function getNoteID() |
@@ -1,12 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../ArticulationType.lua" ); | |
4 | -dofile( "../IconParameter.lua" ); | |
5 | -dofile( "../VibratoBP.lua" ); | |
6 | -dofile( "../VibratoBPList.lua" ); | |
7 | -dofile( "../VibratoHandle.lua" ); | |
8 | -dofile( "../Handle.lua" ); | |
9 | -dofile( "../HandleType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
10 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
11 | 3 | |
12 | 4 | function testToString() |
@@ -1,7 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../PhoneticSymbol.lua" ); | |
4 | -dofile( "../Lyric.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
5 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
6 | 3 | |
7 | 4 | function testConstructWithLine() |
@@ -0,0 +1,9 @@ | ||
1 | +dofile( "./test_bootstrap.lua" ); | |
2 | +module( "enhanced", package.seeall, lunit.testcase ); | |
3 | + | |
4 | +function testConstruct() | |
5 | + local result = luavsq.BPListSearchResult.new(); | |
6 | + assert_equal( 0, result.clock ); | |
7 | + assert_equal( 0, result.index ); | |
8 | + assert_not_nil( result.point ); | |
9 | +end |
@@ -1,7 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../VibratoBP.lua" ); | |
4 | -dofile( "../VibratoBPList.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
5 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
6 | 3 | |
7 | 4 | function testConstructWithString() |
@@ -1,9 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Common.lua" ); | |
3 | -dofile( "../TextStream.lua" ); | |
4 | -dofile( "../DynamicsMode.lua" ); | |
5 | -dofile( "../PlayMode.lua" ); | |
6 | -dofile( "../Util.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
7 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
8 | 3 | |
9 | 4 | function testConstructFromStream() |
@@ -1,6 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../VibratoBP.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
4 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
5 | 3 | |
6 | 4 | function testConstruct() |
@@ -1,18 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../Handle.lua" ); | |
4 | -dofile( "../TextStream.lua" ); | |
5 | -dofile( "../HandleType.lua" ); | |
6 | -dofile( "../Lyric.lua" ); | |
7 | -dofile( "../VibratoBPList.lua" ); | |
8 | -dofile( "../VibratoBP.lua" ); | |
9 | -dofile( "../LyricHandle.lua" ); | |
10 | -dofile( "../ArticulationType.lua" ); | |
11 | -dofile( "../VibratoHandle.lua" ); | |
12 | -dofile( "../IconParameter.lua" ); | |
13 | -dofile( "../IconHandle.lua" ); | |
14 | -dofile( "../NoteHeadHandle.lua" ); | |
15 | -dofile( "../IconDynamicsHandle.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
16 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
17 | 3 | |
18 | 4 | function getLyricStream() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../TimesigTableEntry.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testConstruct() |
@@ -1,12 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../Handle.lua" ); | |
4 | -dofile( "../IconDynamicsHandle.lua" ); | |
5 | -dofile( "../ArticulationType.lua" ); | |
6 | -dofile( "../IconParameter.lua" ); | |
7 | -dofile( "../VibratoBPList.lua" ); | |
8 | -dofile( "../VibratoBP.lua" ); | |
9 | -dofile( "../HandleType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
10 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
11 | 3 | |
12 | 4 | function testConstruct() |
@@ -1,16 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../IDType.lua" ); | |
3 | -dofile( "../ID.lua" ); | |
4 | -dofile( "../IconHandle.lua" ); | |
5 | -dofile( "../LyricHandle.lua" ); | |
6 | -dofile( "../ArticulationType.lua" ); | |
7 | -dofile( "../Lyric.lua" ); | |
8 | -dofile( "../VibratoHandle.lua" ); | |
9 | -dofile( "../IconParameter.lua" ); | |
10 | -dofile( "../VibratoBPList.lua" ); | |
11 | -dofile( "../NoteHeadHandle.lua" ); | |
12 | -dofile( "../IconDynamicsHandle.lua" ); | |
13 | -dofile( "../Util.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
14 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
15 | 3 | |
16 | 4 | function testConstructWithValue() |
@@ -1,11 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../Util.lua" ); | |
3 | -dofile( "../HandleType.lua" ); | |
4 | -dofile( "../Handle.lua" ); | |
5 | -dofile( "../ArticulationType.lua" ); | |
6 | -dofile( "../Lyric.lua" ); | |
7 | -dofile( "../LyricHandle.lua" ); | |
8 | -dofile( "../PhoneticSymbol.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
9 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
10 | 3 | |
11 | 4 | function testConstruct() |
@@ -1,5 +1,4 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../IDType.lua" ); | |
1 | +dofile( "./test_bootstrap.lua" ); | |
3 | 2 | module( "enhanced", package.seeall, lunit.testcase ); |
4 | 3 | |
5 | 4 | function testToString() |
@@ -28,7 +28,7 @@ | ||
28 | 28 | --- |
29 | 29 | -- @return [object] |
30 | 30 | function this:clone() |
31 | - return luavsq.BP( self.value, self.id ); | |
31 | + return luavsq.BP.new( self.value, self.id ); | |
32 | 32 | end |
33 | 33 | |
34 | 34 | return this; |
@@ -0,0 +1,31 @@ | ||
1 | +--[[ | |
2 | + BPListSearchResult.lua | |
3 | + Copyright © 2011 kbinani | |
4 | + | |
5 | + This file is part of luavsq. | |
6 | + | |
7 | + luavsq is free software; you can redistribute it and/or | |
8 | + modify it under the terms of the BSD License. | |
9 | + | |
10 | + luavsq is distributed in the hope that it will be useful, | |
11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
13 | +]] | |
14 | + | |
15 | +if( nil == luavsq )then | |
16 | + luavsq = {}; | |
17 | +end | |
18 | + | |
19 | +if( nil == luavsq.BPListSearchResult )then | |
20 | + | |
21 | + luavsq.BPListSearchResult = {}; | |
22 | + | |
23 | + function luavsq.BPListSearchResult.new() | |
24 | + local this = {}; | |
25 | + this.clock = 0; | |
26 | + this.index = 0; | |
27 | + this.point = luavsq.BP.new(); | |
28 | + return this; | |
29 | + end | |
30 | + | |
31 | +end |
@@ -2,7 +2,7 @@ | ||
2 | 2 | import java.util.*; |
3 | 3 | import java.util.regex.*; |
4 | 4 | |
5 | -class SourceFilePacker | |
5 | +class SourceFilePacker implements Comparator<File> | |
6 | 6 | { |
7 | 7 | public static void main( String[] args ) |
8 | 8 | { |
@@ -11,10 +11,8 @@ | ||
11 | 11 | try{ |
12 | 12 | writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( "luavsq.lua" ), "UTF-8" ) ); |
13 | 13 | writeHeader( writer ); |
14 | - for( File file : directory.listFiles() ){ | |
15 | - if( false == file.getAbsolutePath().endsWith( ".lua" ) ){ | |
16 | - continue; | |
17 | - } | |
14 | + File[] files = sortSourceFiles( directory.listFiles() ); | |
15 | + for( File file : files ){ | |
18 | 16 | concatFile( file.getAbsolutePath(), writer ); |
19 | 17 | } |
20 | 18 | }catch( Exception e ){ |
@@ -28,6 +26,21 @@ | ||
28 | 26 | } |
29 | 27 | } |
30 | 28 | |
29 | + private static File[] sortSourceFiles( File[] files ) | |
30 | + { | |
31 | + Vector<File> paths = new Vector<File>(); | |
32 | + for( File file : files ){ | |
33 | + if( false == file.getAbsolutePath().endsWith( ".lua" ) ){ | |
34 | + continue; | |
35 | + } | |
36 | + paths.add( file ); | |
37 | + } | |
38 | + | |
39 | + Collections.sort( paths, new SourceFilePacker() ); | |
40 | + | |
41 | + return paths.toArray( new File[0] ); | |
42 | + } | |
43 | + | |
31 | 44 | private static void writeHeader( BufferedWriter writer ) |
32 | 45 | throws IOException |
33 | 46 | { |
@@ -151,4 +164,21 @@ | ||
151 | 164 | } |
152 | 165 | return source; |
153 | 166 | } |
167 | + | |
168 | + public int compare( File a, File b ) | |
169 | + { | |
170 | + if( a != null && b != null && a instanceof File && b instanceof File ){ | |
171 | + String pathA = ((File)a).getName(); | |
172 | + String pathB = ((File)b).getName(); | |
173 | + if( pathA.endsWith( ".lua" ) ){ | |
174 | + pathA = pathA.substring( 0, pathA.length() - 4 ); | |
175 | + } | |
176 | + if( pathB.endsWith( ".lua" ) ){ | |
177 | + pathB = pathB.substring( 0, pathB.length() - 4 ); | |
178 | + } | |
179 | + return pathA.compareTo( pathB ); | |
180 | + }else{ | |
181 | + return 0; | |
182 | + } | |
183 | + } | |
154 | 184 | } |