Skip to content

Commit 3cf8412

Browse files
authored
Merge pull request #41 from javecs/feature/test-package
テストコードのパッケージを変更しました。
2 parents 2c3e3c5 + 505dc68 commit 3cf8412

10 files changed

Lines changed: 37 additions & 11 deletions

File tree

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## 使い方
1111

12-
### gradle
12+
### Gradle
1313
- 依存関係を設定してください。
1414
```
1515
repositories {
@@ -109,7 +109,24 @@
109109
 cos | コサイン。三角関数の余弦。 | cos(1) | 0.5403023058681398
110110
 tan | タンジェント。三角関数の正接。 | tan(1) | 1.5574077246549023
111111
112-
112+
113+
## Javaからの呼び出し方
114+
115+
- eval()は、スタティクメッソードで呼びます。
116+
117+
```
118+
Number value = Evaluator.eval("3 + 4");
119+
```
120+
121+
- Calculatorは、通常のクラスとして使えます。
122+
123+
```
124+
Calculator calc = new Calculator();
125+
calc.eval("3 + 4");
126+
Number value = calc.getValue();
127+
```
128+
129+
113130
## サンプルアプリ
114131
115132
- 電卓です。

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
}
1717

1818
group 'xyz.javecs.tools'
19-
version '0.1.4'
19+
version '0.1.5'
2020

2121
apply plugin: 'kotlin'
2222
apply plugin: 'antlr'

src/test/java/xyz/javecs/tools/expr/CalculatorTest.java renamed to src/test/java/xyz/javecs/tools/expr/test/java/CalculatorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr;
1+
package xyz.javecs.tools.expr.test.java;
22

33
import org.junit.Assert;
44
import org.junit.Test;
5+
import xyz.javecs.tools.expr.Calculator;
56

67
public class CalculatorTest {
78
@Test

src/test/java/xyz/javecs/tools/expr/EvaluatorTest.java renamed to src/test/java/xyz/javecs/tools/expr/test/java/EvaluatorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr;
1+
package xyz.javecs.tools.expr.test.java;
22

33
import org.junit.Assert;
44
import org.junit.Test;
5+
import xyz.javecs.tools.expr.Evaluator;
56

67
public class EvaluatorTest {
78
@Test

src/test/kotlin/xyz/javecs/tools/expr/CalculatorAssignTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorAssignTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.Calculator
56

67
class CalculatorAssignTest {
78
@Test fun calcAssign1() {

src/test/kotlin/xyz/javecs/tools/expr/CalculatorEvalTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorEvalTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.Calculator
56

67
class CalculatorEvalTest {
78
@Test fun calcEvaluateTest1() {

src/test/kotlin/xyz/javecs/tools/expr/CalculatorExprTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorExprTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.Calculator
56

67
class CalculatorExprTest {
78
@Test fun calcExpr1() {

src/test/kotlin/xyz/javecs/tools/expr/CalculatorFunTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorFunTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.Calculator
56

67
class CalculatorFunTest {
78
@Test fun clearTest() {

src/test/kotlin/xyz/javecs/tools/expr/CalculatorMathTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/CalculatorMathTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.Calculator
56

67
class CalculatorMathTest {
78
@Test fun mathSin() {

src/test/kotlin/xyz/javecs/tools/expr/ExprApplicationTest.kt renamed to src/test/kotlin/xyz/javecs/tools/expr/test/kotlin/ExprApplicationTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
package xyz.javecs.tools.expr
1+
package xyz.javecs.tools.expr.test.kotlin
22

33
import kotlin.test.assertEquals
44
import org.junit.Test
5+
import xyz.javecs.tools.expr.eval
6+
import xyz.javecs.tools.expr.parserTree
57

68
class TestApplication {
79
@Test fun evalTree() {

0 commit comments

Comments
 (0)