Protobuf: removed generating stub package in Protobuf messages. Fixed tests accordingly
This commit is contained in:
+81
-25
@@ -80,7 +80,7 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="600">
|
||||
<file leaf-file-name="build.gradle" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="build.gradle" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/build.gradle">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="756">
|
||||
@@ -90,6 +90,28 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="BaseExtendedTest.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/kt_java_tests/BaseExtendedTest.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="72">
|
||||
<caret line="2" column="0" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#23#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="base_message.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/kotlin/base_message.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
@@ -357,8 +379,6 @@
|
||||
<option value="$PROJECT_DIR$/src/tests/Util.kt" />
|
||||
<option value="$PROJECT_DIR$/src/tests/VarintsTest.kt" />
|
||||
<option value="$PROJECT_DIR$/src/main/kotlin/WireType.kt" />
|
||||
<option value="$PROJECT_DIR$/build.gradle" />
|
||||
<option value="$PROJECT_DIR$/src/kotlin/base_message.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kotlin/connect.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kotlin/cross_branch.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kotlin/direction.kt" />
|
||||
@@ -381,8 +401,10 @@
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/Location.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/CrossBranchTest.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/ConnectTest.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/BaseExtendedTest.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/Util.kt" />
|
||||
<option value="$PROJECT_DIR$/build.gradle" />
|
||||
<option value="$PROJECT_DIR$/src/kt_java_tests/BaseExtendedTest.kt" />
|
||||
<option value="$PROJECT_DIR$/src/kotlin/base_message.kt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -401,7 +423,7 @@
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="3840" />
|
||||
<option name="y" value="48" />
|
||||
<option name="y" value="-2112" />
|
||||
<option name="width" value="3840" />
|
||||
<option name="height" value="2112" />
|
||||
</component>
|
||||
@@ -482,8 +504,40 @@
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="tests" />
|
||||
<option name="myItemId" value="protoc-test-project" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="protoc-test-project" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="kt_java_tests" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="protoc-test-project" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="protoc-test-project" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="kotlin" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
@@ -962,15 +1016,15 @@
|
||||
<workItem from="1470904528165" duration="51301000" />
|
||||
<workItem from="1471248559073" duration="28000" />
|
||||
<workItem from="1471248659432" duration="1881000" />
|
||||
<workItem from="1471250698982" duration="1755000" />
|
||||
<workItem from="1471250698982" duration="2717000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="3668000" />
|
||||
<option name="totallyTimeSpent" value="4630000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="3840" y="48" width="3840" height="2112" extended-state="6" />
|
||||
<frame x="3840" y="-2112" width="3840" height="2112" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
@@ -1159,14 +1213,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kotlin/base_message.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kotlin/cross_branch.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
@@ -1343,14 +1389,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kt_java_tests/BaseExtendedTest.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="416">
|
||||
<caret line="156" column="8" selection-start-line="156" selection-start-column="8" selection-end-line="156" selection-end-column="8" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kt_java_tests/Util.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="144">
|
||||
@@ -1367,6 +1405,24 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kt_java_tests/BaseExtendedTest.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="72">
|
||||
<caret line="2" column="0" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#23#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/kotlin/base_message.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
||||
+8
-12
@@ -1,17 +1,13 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.BaseMessage
|
||||
import java_msg.ExtendedMessage
|
||||
import main.kotlin.Base
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.Extended
|
||||
import Base
|
||||
import CodedInputStream
|
||||
import Extended
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
|
||||
/**
|
||||
* Created by user on 8/11/16.
|
||||
*/
|
||||
|
||||
object BaseExtendedTest {
|
||||
fun generateKtBaseMessage(): Base {
|
||||
val arrSize = RandomGen.rnd.nextInt(1000)
|
||||
@@ -95,13 +91,13 @@ object BaseExtendedTest {
|
||||
.build()
|
||||
}
|
||||
|
||||
fun compareBases(kt: main.kotlin.Base, jv: BaseMessage.Base): Boolean {
|
||||
fun compareBases(kt: Base, jv: BaseMessage.Base): Boolean {
|
||||
return kt.flag == jv.flag &&
|
||||
kt.int == jv.int &&
|
||||
Util.compareArrays(kt.arr.asIterable(), jv.arrList)
|
||||
}
|
||||
|
||||
fun compareExtended(kt: main.kotlin.Extended, jv: ExtendedMessage.Extended): Boolean {
|
||||
fun compareExtended(kt: Extended, jv: ExtendedMessage.Extended): Boolean {
|
||||
return kt.flag == jv.flag &&
|
||||
kt.int == jv.int &&
|
||||
Util.compareArrays(kt.arr.asIterable(), jv.arrList) &&
|
||||
@@ -109,13 +105,13 @@ object BaseExtendedTest {
|
||||
kt.long == jv.long
|
||||
}
|
||||
|
||||
fun compareBaseKtToJavaExtended(kt: main.kotlin.Base, jv: ExtendedMessage.Extended): Boolean {
|
||||
fun compareBaseKtToJavaExtended(kt: Base, jv: ExtendedMessage.Extended): Boolean {
|
||||
return kt.flag == jv.flag &&
|
||||
kt.int == jv.int &&
|
||||
Util.compareArrays(kt.arr.asIterable(), jv.arrList)
|
||||
}
|
||||
|
||||
fun compareExtendedKtToJavaBase(kt: main.kotlin.Extended, jv: BaseMessage.Base): Boolean {
|
||||
fun compareExtendedKtToJavaBase(kt: Extended, jv: BaseMessage.Base): Boolean {
|
||||
return kt.flag == jv.flag &&
|
||||
kt.int == jv.int &&
|
||||
Util.compareArrays(kt.arr.asIterable(), jv.arrList)
|
||||
|
||||
+9
-10
@@ -1,11 +1,12 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Connect
|
||||
import main.kotlin.CodedInputStream
|
||||
import CodedInputStream
|
||||
import ConnectionRequest
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
object ConnectTest {
|
||||
fun generateKotlinConnectionRequestMessage(): main.kotlin.ConnectionRequest {
|
||||
fun generateKotlinConnectionRequestMessage(): ConnectionRequest {
|
||||
val arrSize = RandomGen.rnd.nextInt(1000)
|
||||
val arr = IntArray(arrSize)
|
||||
for (i in 0..(arrSize - 1)) {
|
||||
@@ -14,7 +15,7 @@ object ConnectTest {
|
||||
|
||||
val port = RandomGen.rnd.nextInt()
|
||||
|
||||
val msg = main.kotlin.ConnectionRequest.BuilderConnectionRequest(arr, port).build()
|
||||
val msg = ConnectionRequest.BuilderConnectionRequest(arr, port).build()
|
||||
|
||||
return msg
|
||||
}
|
||||
@@ -36,7 +37,7 @@ object ConnectTest {
|
||||
|
||||
|
||||
|
||||
fun compareConnectionRequests(kt: main.kotlin.ConnectionRequest, jv: Connect.ConnectionRequest): Boolean {
|
||||
fun compareConnectionRequests(kt: ConnectionRequest, jv: Connect.ConnectionRequest): Boolean {
|
||||
return Util.compareArrays(kt.ip.asIterable(), jv.ipList.asIterable())
|
||||
}
|
||||
|
||||
@@ -50,8 +51,7 @@ object ConnectTest {
|
||||
val jvConnectionRequest = Connect.ConnectionRequest.parseFrom(ins)
|
||||
|
||||
Util.assert(ktConnectionRequest.errorCode == 0)
|
||||
Util.assert(Util.compareArrays(ktConnectionRequest.ip.asIterable(), jvConnectionRequest.ipList))
|
||||
Util.assert(ktConnectionRequest.port == jvConnectionRequest.port)
|
||||
Util.assert(compareConnectionRequests(ktConnectionRequest, jvConnectionRequest))
|
||||
}
|
||||
|
||||
val testRuns = 10
|
||||
@@ -68,11 +68,10 @@ object ConnectTest {
|
||||
val jvConnectionRequest = generateJavaConnectionRequest()
|
||||
jvConnectionRequest.writeTo(outs)
|
||||
val ins = CodedInputStream(outs.toByteArray())
|
||||
val ktConnectionRequest = main.kotlin.ConnectionRequest.BuilderConnectionRequest(IntArray(0), 0).parseFrom(ins)
|
||||
val ktConnectionRequest = ConnectionRequest.BuilderConnectionRequest(IntArray(0), 0).parseFrom(ins).build()
|
||||
|
||||
Util.assert(ktConnectionRequest.errorCode == 0)
|
||||
Util.assert(Util.compareArrays(ktConnectionRequest.ip.asIterable(), jvConnectionRequest.ipList))
|
||||
Util.assert(ktConnectionRequest.port == jvConnectionRequest.port)
|
||||
Util.assert(compareConnectionRequests(ktConnectionRequest, jvConnectionRequest))
|
||||
}
|
||||
|
||||
fun JavaToKt() {
|
||||
|
||||
+9
-13
@@ -1,19 +1,15 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.CrossBranchOuterClass
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.CrossBranch
|
||||
import CodedInputStream
|
||||
import CrossBranch
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
* Created by user on 8/11/16.
|
||||
*/
|
||||
|
||||
object CrossBranchTest {
|
||||
fun generateKtGrandFather(): main.kotlin.CrossBranch.Grandfather {
|
||||
fun generateKtRightFather(): main.kotlin.CrossBranch.Grandfather.RightFather {
|
||||
fun generateKtRightLeftSon(): main.kotlin.CrossBranch.Grandfather.RightFather.RightLeftSon {
|
||||
fun generateKtLeftLeftSon(): main.kotlin.CrossBranch.Grandfather.LeftFather.LeftLeftSon {
|
||||
fun generateKtGrandFather(): CrossBranch.Grandfather {
|
||||
fun generateKtRightFather(): CrossBranch.Grandfather.RightFather {
|
||||
fun generateKtRightLeftSon(): CrossBranch.Grandfather.RightFather.RightLeftSon {
|
||||
fun generateKtLeftLeftSon(): CrossBranch.Grandfather.LeftFather.LeftLeftSon {
|
||||
return CrossBranch.Grandfather.LeftFather.LeftLeftSon.BuilderLeftLeftSon(RandomGen.rnd.nextInt()).build()
|
||||
}
|
||||
|
||||
@@ -24,7 +20,7 @@ object CrossBranchTest {
|
||||
}
|
||||
|
||||
fun generateKtRightRightSon(): CrossBranch.Grandfather.RightFather.RightRightSon {
|
||||
fun generateKtLeftRightSon(): main.kotlin.CrossBranch.Grandfather.LeftFather.LeftRightSon {
|
||||
fun generateKtLeftRightSon(): CrossBranch.Grandfather.LeftFather.LeftRightSon {
|
||||
return CrossBranch.Grandfather.LeftFather.LeftRightSon.BuilderLeftRightSon(RandomGen.rnd.nextInt()).build()
|
||||
}
|
||||
|
||||
@@ -33,7 +29,7 @@ object CrossBranchTest {
|
||||
).build()
|
||||
}
|
||||
|
||||
val msg = main.kotlin.CrossBranch.Grandfather.RightFather.BuilderRightFather(
|
||||
val msg = CrossBranch.Grandfather.RightFather.BuilderRightFather(
|
||||
generateKtRightLeftSon(),
|
||||
generateKtRightRightSon()
|
||||
).build()
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Direction
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.DirectionRequest
|
||||
import CodedInputStream
|
||||
import DirectionRequest
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
object DirectionTest {
|
||||
|
||||
+3
-7
@@ -1,14 +1,10 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Location
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.LocationResponse
|
||||
import CodedInputStream
|
||||
import LocationResponse
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
* Created by user on 8/11/16.
|
||||
*/
|
||||
|
||||
object Location {
|
||||
fun generateKtLocationResponse(): LocationResponse {
|
||||
fun generateKtLocationData(): LocationResponse.LocationData {
|
||||
|
||||
+5
-9
@@ -1,16 +1,12 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.MultipleMessages
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.FirstMessage
|
||||
import main.kotlin.SecondMessage
|
||||
import main.kotlin.ThirdMessage
|
||||
import CodedInputStream
|
||||
import FirstMessage
|
||||
import SecondMessage
|
||||
import ThirdMessage
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
* Created by user on 8/11/16.
|
||||
*/
|
||||
|
||||
object MultipleMessagesTest {
|
||||
fun generateKtFirstMessage(): FirstMessage {
|
||||
return FirstMessage.BuilderFirstMessage(RandomGen.rnd.nextInt()).build()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
+3
-7
@@ -1,14 +1,10 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.RepeatedVarints
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.MessageRepeatedVarints
|
||||
import CodedInputStream
|
||||
import MessageRepeatedVarints
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
* Created by user on 8/12/16.
|
||||
*/
|
||||
|
||||
object RepeatedVarintsTest {
|
||||
fun generateKtRepeatedVarints(): MessageRepeatedVarints {
|
||||
val int = Util.generateIntArray()
|
||||
|
||||
+4
-8
@@ -1,14 +1,10 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.RepeatedZigzag
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.MessageRepeatedZigZag
|
||||
import CodedInputStream
|
||||
import MessageRepeatedZigZag
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
* Created by user on 8/12/16.
|
||||
*/
|
||||
|
||||
object RepeatedZigZag {
|
||||
fun generateKtRepeatedZigZag(): MessageRepeatedZigZag {
|
||||
val int = Util.generateIntArray()
|
||||
@@ -27,7 +23,7 @@ object RepeatedZigZag {
|
||||
|
||||
fun compareRepeatedZigZags(kt: MessageRepeatedZigZag, jv: RepeatedZigzag.MessageRepeatedZigZag): Boolean {
|
||||
return Util.compareArrays(kt.int.asIterable(), jv.intList) &&
|
||||
Util.compareArrays(kt.long.asIterable(), jv.longList);
|
||||
Util.compareArrays(kt.long.asIterable(), jv.longList)
|
||||
}
|
||||
|
||||
fun ktToJavaOnce() {
|
||||
|
||||
+4
-5
@@ -1,11 +1,10 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.RepeatedZigzag
|
||||
import java_msg.TagOrderOuterClass
|
||||
import java_msg.TagOrderShuffledOuterClass
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.TagOrder
|
||||
import main.kotlin.TagOrderShuffled
|
||||
import CodedInputStream
|
||||
import TagOrder
|
||||
import TagOrderShuffled
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
object TagOrderTests {
|
||||
|
||||
+5
-19
@@ -1,11 +1,8 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.util.concurrent.locks.Condition
|
||||
import kotlin.system.exitProcess
|
||||
import CodedOutputStream
|
||||
|
||||
object Util {
|
||||
var ARRAY_MAX_SIZE = 1000
|
||||
@@ -21,27 +18,16 @@ object Util {
|
||||
return lhs.count() == rhs.count() && lhs.filter { !rhs.contains(it) }.isEmpty()
|
||||
}
|
||||
|
||||
fun getKtInputStream(): main.kotlin.CodedInputStream {
|
||||
val ba = ByteArray(100000)
|
||||
val ins = main.kotlin.CodedInputStream(ba)
|
||||
return ins
|
||||
}
|
||||
|
||||
fun getKtOutputStream(size: Int): main.kotlin.CodedOutputStream {
|
||||
fun getKtOutputStream(size: Int): CodedOutputStream {
|
||||
val ba = ByteArray(size)
|
||||
val outs = main.kotlin.CodedOutputStream(ba)
|
||||
val outs = CodedOutputStream(ba)
|
||||
return outs
|
||||
}
|
||||
|
||||
fun KtOutputStreamToInputStream(kt: main.kotlin.CodedOutputStream): InputStream {
|
||||
fun KtOutputStreamToInputStream(kt: CodedOutputStream): InputStream {
|
||||
return kt.buffer.inputStream()
|
||||
}
|
||||
|
||||
fun KtInputStreamToOutputStream(kt: main.kotlin.CodedInputStream): OutputStream {
|
||||
val baos = ByteArrayOutputStream(kt.buffer.size)
|
||||
return baos
|
||||
}
|
||||
|
||||
fun generateIntArray(): IntArray {
|
||||
val size = RandomGen.rnd.nextInt(ARRAY_MAX_SIZE)
|
||||
val arr = IntArray(size)
|
||||
|
||||
+3
-4
@@ -1,10 +1,9 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Varints
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.MessageVarints
|
||||
import CodedInputStream
|
||||
import MessageVarints
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.util.*
|
||||
|
||||
object VarintsTest {
|
||||
fun generateKtVarint(): MessageVarints {
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Zigzag
|
||||
import main.kotlin.CodedInputStream
|
||||
import main.kotlin.MessageZigZag
|
||||
import CodedInputStream
|
||||
import MessageZigZag
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
object ZigZagTests {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tests
|
||||
package kt_java_tests
|
||||
|
||||
import java_msg.Varints
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ bool FileGenerator::Generate(const FileDescriptor *file, const string ¶meter
|
||||
classes.push_back(cgen);
|
||||
}
|
||||
|
||||
// generate package directive
|
||||
// XXX: stub here, resolve options properly!
|
||||
printer.Print("package main.kotlin\n");
|
||||
|
||||
// Generate code and clean up
|
||||
generateCode(&printer, classes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user