-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5691f87
commit fe6a9ae
Showing
12 changed files
with
222 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Installation | ||
|
||
## Maven | ||
|
||
Add the following to your `pom.xml` file; | ||
|
||
```xml | ||
<dependency> | ||
<groupId>me.nathanfallet.makth</groupId> | ||
<artifactId>makth</artifactId> | ||
<version>1.1.0</version> | ||
</dependency> | ||
``` | ||
|
||
## Gradle | ||
|
||
Add the following to your `build.gradle` file: | ||
|
||
```groovy | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
implementation 'me.nathanfallet.makth:makth:1.1.0' | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/kotlin/me/nathanfallet/makth/extensions/BooleanExtensionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package me.nathanfallet.makth.extensions | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class BooleanExtensionTest { | ||
|
||
@Test | ||
fun toAlgorithmStringTrue() { | ||
assertEquals("true", BooleanValue(true).toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawStringTrue() { | ||
assertEquals("true", BooleanValue(true).toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXStringTrue() { | ||
assertEquals("\\text{true}", BooleanValue(true).toLaTeXString()) | ||
} | ||
|
||
@Test | ||
fun toAlgorithmStringFalse() { | ||
assertEquals("false", BooleanValue(false).toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawStringFalse() { | ||
assertEquals("false", BooleanValue(false).toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXStringFalse() { | ||
assertEquals("\\text{false}", BooleanValue(false).toLaTeXString()) | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
src/test/kotlin/me/nathanfallet/makth/extensions/LongExtensionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package me.nathanfallet.makth.extensions | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class LongExtensionTest { | ||
|
||
@Test | ||
fun gcd() { | ||
assertEquals(2L, 4L.gcd(6L)) | ||
} | ||
|
||
@Test | ||
fun gcdWithZero() { | ||
assertEquals(4L, 4L.gcd(0L)) | ||
} | ||
|
||
@Test | ||
fun gcdWithZero2() { | ||
assertEquals(6L, 0L.gcd(6L)) | ||
} | ||
|
||
@Test | ||
fun power() { | ||
assertEquals(8L, 2L.pow(3L)) | ||
} | ||
|
||
@Test | ||
fun nthRoot() { | ||
assertEquals(2.0, 4L.nthRoot(2L), 0.0) | ||
} | ||
|
||
@Test | ||
fun nthRoot2() { | ||
assertEquals(16.0, 256L.nthRoot(2L), 0.0) | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
src/test/kotlin/me/nathanfallet/makth/extensions/StringExtensionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package me.nathanfallet.makth.extensions | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class StringExtensionTest { | ||
|
||
@Test | ||
fun toAlgorithmString() { | ||
assertEquals("\"Hello world!\"", StringValue("Hello world!").toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawString() { | ||
assertEquals("Hello world!", StringValue("Hello world!").toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXString() { | ||
assertEquals("\\text{Hello world!}", StringValue("Hello world!").toLaTeXString()) | ||
} | ||
|
||
@Test | ||
fun toAlgorithmStringWithLaTeX() { | ||
assertEquals("\$x ^ 2\$", StringValue("x ^ 2", true).toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawStringWithLaTeX() { | ||
assertEquals("x ^ 2", StringValue("x ^ 2", true).toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXStringWithLaTeX() { | ||
assertEquals("x ^ 2", StringValue("x ^ 2", true).toLaTeXString()) | ||
} | ||
|
||
@Test | ||
fun toAlgorithmStringWithEscape() { | ||
assertEquals("\"Hello \\\"world\\\"!\"", StringValue("Hello \"world\"!").toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawStringWithEscape() { | ||
assertEquals("Hello \"world\"!", StringValue("Hello \"world\"!").toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXStringWithEscape() { | ||
assertEquals("\\text{Hello \"world\"!}", StringValue("Hello \"world\"!").toLaTeXString()) | ||
} | ||
|
||
@Test | ||
fun toAlgorithmStringWithLaTeXAndEscape() { | ||
assertEquals("\$x \\\$ 2\$", StringValue("x \$ 2", true).toAlgorithmString()) | ||
} | ||
|
||
@Test | ||
fun toRawStringWithLaTeXAndEscape() { | ||
assertEquals("x \$ 2", StringValue("x \$ 2", true).toRawString()) | ||
} | ||
|
||
@Test | ||
fun toLaTeXStringWithLaTeXAndEscape() { | ||
assertEquals("x \\\$ 2", StringValue("x \$ 2", true).toLaTeXString()) | ||
} | ||
|
||
} |
Oops, something went wrong.