Skip to content

Commit

Permalink
Merge branch 'develop' into remove-kitkat-support
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHenning authored Feb 13, 2025
2 parents 7a70638 + 3eb4fb5 commit 7b8f6c0
Show file tree
Hide file tree
Showing 11 changed files with 352 additions and 82 deletions.
6 changes: 3 additions & 3 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<string name="concept_card_toolbar_title">بطاقة المفهوم</string>
<string name="concept_card_one_button_text">بطاقة المفاهيم 1</string>
<string name="concept_card_two_button_text">بطاقة المفاهيم 2</string>
<string name="revision_card_toolbar_title">بطاقة المراجعة</string>
<string name="revision_card_toolbar_title">دليل الدراسة</string>
<string name="unsaved_exploration_dialog_title">هل تريد المغادرة إلى صفحة الموضوع؟</string>
<string name="unsaved_exploration_dialog_description">لن يتم حفظ تقدمك.</string>
<string name="unsaved_exploration_dialog_leave_button">مغادرة</string>
Expand Down Expand Up @@ -90,9 +90,9 @@
<string name="onboarding_activity_title">مقدمة</string>
<string name="frequently_asked_questions_FAQ">الأسئلة الأكثر تكرارا</string>
<string name="info">معلومات</string>
<string name="lessons">الدروس</string>
<string name="learn">تعلم</string>
<string name="practice">ممارسة</string>
<string name="revision">مراجعة</string>
<string name="study">يذاكر</string>
<string name="administrator_controls_title">أدوات تحكم المشرف</string>
<string name="topic_page">صفحة الموضوع</string>
<string name="topic_name">الموضوع: %s</string>
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/values-pcm-rNG/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<string name="concept_card_toolbar_title">Concept Card</string>
<string name="concept_card_one_button_text">Concept Card 1</string>
<string name="concept_card_two_button_text">Concept Card 2</string>
<string name="revision_card_toolbar_title">Revision Card</string>
<string name="revision_card_toolbar_title" fuzzy="true">Revision Card</string>
<string name="unsaved_exploration_dialog_title">Comot go the topic page?</string>
<string name="unsaved_exploration_dialog_description">Wetin you don do before no go save</string>
<string name="unsaved_exploration_dialog_leave_button">Comot</string>
Expand Down Expand Up @@ -86,9 +86,7 @@
<string name="onboarding_activity_title">Introduction</string>
<string name="frequently_asked_questions_FAQ">Frequently Asked Questions (FAQs)</string>
<string name="info">Info</string>
<string name="lessons">Lessons</string>
<string name="practice">Practice</string>
<string name="revision">Revision</string>
<string name="administrator_controls_title">Administrator Controls</string>
<string name="topic_page">Topic page</string>
<string name="topic_name">Topic: %s</string>
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<string name="concept_card_toolbar_title">Cartão de Conceito</string>
<string name="concept_card_one_button_text">Cartão Conceitual 1</string>
<string name="concept_card_two_button_text">Cartão Conceitual 2</string>
<string name="revision_card_toolbar_title">Cartão de Revisão</string>
<string name="revision_card_toolbar_title" fuzzy="true">Cartão de Revisão</string>
<string name="unsaved_exploration_dialog_title">Pretende ir para a página do tópico?</string>
<string name="unsaved_exploration_dialog_description">Seu progresso não será salvo.</string>
<string name="unsaved_exploration_dialog_leave_button">Sair</string>
Expand Down Expand Up @@ -96,9 +96,7 @@
<string name="onboarding_activity_title">Introdução</string>
<string name="frequently_asked_questions_FAQ">Perguntas Frequentes (FAQs)</string>
<string name="info">Info</string>
<string name="lessons">Lições</string>
<string name="practice">Prática</string>
<string name="revision">Revisão</string>
<string name="administrator_controls_title">Controles do administrador</string>
<string name="topic_page">Página do tópico</string>
<string name="topic_name">Tópico: %s</string>
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<string name="cellular_data_alert_dialog_description">Kutiririsha sauti kunaweza kutumia data nyingi ya mtandao wa simu.</string>
<string name="cellular_data_alert_dialog_checkbox">Usionyeshe ujumbe huu tena</string>
<string name="concept_card_toolbar_title">Kadi ya Dhana</string>
<string name="revision_card_toolbar_title">Kadi ya Marudio</string>
<string name="revision_card_toolbar_title" fuzzy="true">Kadi ya Marudio</string>
<string name="unsaved_exploration_dialog_title">Je, ungependa kwenda kwenye Ukurasa wa Mada?</string>
<string name="unsaved_exploration_dialog_description">Maendeleo yako hayatahifadhiwa.</string>
<string name="unsaved_exploration_dialog_leave_button">Toka</string>
Expand Down Expand Up @@ -69,9 +69,7 @@
<string name="onboarding_activity_title">Utangulizi</string>
<string name="frequently_asked_questions_FAQ">maswali yanayoulizwa mara kwa mara</string>
<string name="info">habari</string>
<string name="lessons">Masomo</string>
<string name="practice">Mazoezi</string>
<string name="revision">Mazoezi</string>
<string name="administrator_controls_title">Vidhibiti vya Msimamizi</string>
<string name="topic_page">Ukurasa wa mada</string>
<string name="topic_name">mada: %s</string>
Expand Down
4 changes: 2 additions & 2 deletions scripts/assets/maven_dependencies.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ maven_dependency {
}
}
maven_dependency {
artifact_name: "androidx.concurrent:concurrent-futures:1.0.0"
artifact_version: "1.0.0"
artifact_name: "androidx.concurrent:concurrent-futures:1.1.0"
artifact_version: "1.1.0"
license {
license_name: "The Apache Software License, Version 2.0"
original_link: "https://www.apache.org/licenses/LICENSE-2.0.txt"
Expand Down
4 changes: 0 additions & 4 deletions scripts/assets/test_file_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -4106,10 +4106,6 @@ test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/math/MathParsingErrorSubject.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/math/TokenSubject.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/mockito/MockitoKotlinHelper.kt"
test_file_not_required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import org.oppia.android.util.math.MathTokenizer.Companion.Token.RightParenthesi
import org.oppia.android.util.math.MathTokenizer.Companion.Token.SquareRootSymbol
import org.oppia.android.util.math.MathTokenizer.Companion.Token.VariableName

// TODO(#4121): Add tests for this class.

/**
* Truth subject for verifying properties of [Token]s.
*
Expand Down
14 changes: 14 additions & 0 deletions testing/src/test/java/org/oppia/android/testing/math/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,17 @@ oppia_android_test(
"//third_party:robolectric_android-all",
],
)

oppia_android_test(
name = "TokenSubjectTest",
srcs = ["TokenSubjectTest.kt"],
custom_package = "org.oppia.android.testing.math",
test_class = "org.oppia.android.testing.math.TokenSubjectTest",
test_manifest = "//testing:test_manifest",
deps = [
"//testing/src/main/java/org/oppia/android/testing/math:token_subject",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
"//third_party:robolectric_android-all",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
package org.oppia.android.testing.math

import org.junit.Assert.assertThrows
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.oppia.android.util.math.MathTokenizer.Companion.Token

/** Tests for [TokenSubject]. */
@RunWith(JUnit4::class)
class TokenSubjectTest {

@Test
fun testTokenSubject_passesWithCorrectStartIndex() {
val token = Token.PositiveInteger(42, 10, 15)
TokenSubject.assertThat(token).hasStartIndexThat().isEqualTo(10)
}

@Test
fun testTokenSubject_failsWithIncorrectStartIndex() {
val token = Token.PositiveInteger(42, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).hasStartIndexThat().isEqualTo(11)
}
}

@Test
fun testTokenSubject_passesWithCorrectEndIndex() {
val token = Token.PositiveInteger(42, 10, 15)
TokenSubject.assertThat(token).hasEndIndexThat().isEqualTo(15)
}

@Test
fun testTokenSubject_failsWithIncorrectEndIndex() {
val token = Token.PositiveInteger(42, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).hasEndIndexThat().isEqualTo(14)
}
}

@Test
fun testTokenSubject_passesWithCorrectPositiveIntegerValue() {
val token = Token.PositiveInteger(42, 10, 15)
TokenSubject.assertThat(token).isPositiveIntegerWhoseValue().isEqualTo(42)
}

@Test
fun testTokenSubject_failsWithIncorrectPositiveIntegerValue() {
val token = Token.PositiveInteger(42, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).isPositiveIntegerWhoseValue().isEqualTo(45)
}
}

@Test
fun testTokenSubject_passesWithCoreectPositiveRealNumberValue() {
val token = Token.PositiveRealNumber(3.14, 10, 15)
TokenSubject.assertThat(token).isPositiveRealNumberWhoseValue().isEqualTo(3.14)
}

fun testTokenSubject_failsWithIncorrectPositiveRealNumberValue() {
val token = Token.PositiveRealNumber(3.14, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).isPositiveRealNumberWhoseValue().isEqualTo(25)
}
}

@Test
fun testTokenSubject_passesWithCorrectVariableName() {
val token = Token.VariableName("x", 10, 15)
TokenSubject.assertThat(token).isVariableWhoseName().isEqualTo("x")
}

@Test
fun testTokenSubject_isVariableWhoseName_incorrectName_fails() {
val token = Token.VariableName("x", 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).isVariableWhoseName().isEqualTo("y")
}
}

@Test
fun testTokenSubject_passesWithCorrectFunctionNameAndAllowedStatus() {
val token = Token.FunctionName("sqrt", true, 10, 15)
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasNameThat().isEqualTo("sqrt")
}

@Test
fun testTokenSubject_failsWithIncorrectFunctionNameAndAllowedStatus() {
val token = Token.FunctionName("sqrt", true, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasNameThat().isEqualTo("sine")
}
}

@Test
fun testTokenSubject_symbolIsMinusSymbol() {
val token = Token.MinusSymbol(10, 11)
TokenSubject.assertThat(token).isMinusSymbol()
}

@Test
fun testTokenSubject_symbolIsSquareRootSymbol() {
val token = Token.SquareRootSymbol(10, 11)
TokenSubject.assertThat(token).isSquareRootSymbol()
}

@Test
fun testTokenSubject_symbolIsPlusSymbol() {
val token = Token.PlusSymbol(10, 11)
TokenSubject.assertThat(token).isPlusSymbol()
}

@Test
fun testTokenSubject_symbolIsMultiplySymbol() {
val token = Token.MultiplySymbol(10, 11)
TokenSubject.assertThat(token).isMultiplySymbol()
}

@Test
fun testTokenSubject_symbolIsDivideSymbol() {
val token = Token.DivideSymbol(10, 11)
TokenSubject.assertThat(token).isDivideSymbol()
}

@Test
fun testTokenSubject_symbolIsExponentiationSymbol() {
val token = Token.ExponentiationSymbol(10, 11)
TokenSubject.assertThat(token).isExponentiationSymbol()
}

@Test
fun testTokenSubject_symbolIsEqualsSymbol() {
val token = Token.EqualsSymbol(10, 11)
TokenSubject.assertThat(token).isEqualsSymbol()
}

@Test
fun testTokenSubject_symbolIsLeftParenthesisSymbol() {
val token = Token.LeftParenthesisSymbol(10, 11)
TokenSubject.assertThat(token).isLeftParenthesisSymbol()
}

@Test
fun testTokenSubject_symbolIsRightParenthesisSymbol() {
val token = Token.RightParenthesisSymbol(10, 11)
TokenSubject.assertThat(token).isRightParenthesisSymbol()
}

@Test
fun testTokenSubject_failsWithIncorrectSymbol() {
val token = Token.RightParenthesisSymbol(10, 11)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).isMinusSymbol()
}
}

@Test
fun testTokenSubject_checkIsInvalidToken_passes() {
val token = Token.InvalidToken(10, 11)
TokenSubject.assertThat(token).isInvalidToken()
}

@Test
fun testTokenSubject_checkIsInvalidToken_fails() {
val token = Token.PositiveInteger(10, 11, 42)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token).isInvalidToken()
}
}

@Test
fun testTokenSubject_checkIsIncompleteFunctionName() {
val token = Token.IncompleteFunctionName(10, 11)
TokenSubject.assertThat(token).isIncompleteFunctionName()
}

@Test
fun testTokenSubject_functionNameSubject_nameCheck_passes() {
val token = Token.FunctionName("sqrt", true, 10, 15)
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasNameThat().isEqualTo("sqrt")
}

@Test
fun testTokenSubject_functionNameSubject_nameCheck_fails() {
val token = Token.FunctionName("sqrt", true, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasNameThat().isEqualTo("sin")
}
}

@Test
fun testTokenSubject_functionNameSubject_allowedPropertyCheck_passes() {
val token = Token.FunctionName("sqrt", true, 10, 15)
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasIsAllowedPropertyThat().isTrue()
}

@Test
fun testTokenSubject_functionNameSubject_allowedPropertyCheck_fails() {
val token = Token.FunctionName("sqrt", false, 10, 15)
assertThrows(AssertionError::class.java) {
TokenSubject.assertThat(token)
.isFunctionNameThat()
.hasIsAllowedPropertyThat().isTrue()
}
}
}
Loading

0 comments on commit 7b8f6c0

Please sign in to comment.