Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement inequality operators (<, >, <=, >=) in the enable when statement #848

Merged
merged 20 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update test
  • Loading branch information
santosh-pingle committed Nov 18, 2021
commit 554c82be8e871792e2ad9019502d436258f9bfb8
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
import com.google.common.truth.Truth.assertThat
import java.math.BigDecimal
import kotlin.test.assertFailsWith
import org.hl7.fhir.r4.model.Quantity
import org.hl7.fhir.r4.model.Questionnaire
import org.hl7.fhir.r4.model.QuestionnaireResponse
Expand Down Expand Up @@ -189,34 +188,6 @@ class QuestionnaireItemEditTextQuantityViewHolderFactoryInstrumentedTest {
assertThat(questionnaireItemViewItem.questionnaireResponseItem.answer.size).isEqualTo(0)
}

@Test
@UiThreadTest
fun displayValidationResult_shouldThrowNotImplementedError() {
assertFailsWith<NotImplementedError> {
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply {
addExtension().apply {
url = "http:https://hl7.org/fhir/StructureDefinition/minValue"
setValue(Quantity(2.2))
}
addExtension().apply {
url = "http:https://hl7.org/fhir/StructureDefinition/maxValue"
setValue(Quantity(4.4))
}
},
QuestionnaireResponse.QuestionnaireResponseItemComponent().apply {
addAnswer(
QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply {
value = Quantity(3.3)
}
)
}
) {}
)
}
}

@Test
@UiThreadTest
fun displayValidationResult_error_shouldShowErrorMessage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@ private val Questionnaire.QuestionnaireItemEnableWhenComponent.predicate:
!equals(it.value, answer)
}
Questionnaire.QuestionnaireItemOperator.GREATER_THAN -> {
// True if whether at least no answer has a value that is greater than the enableWhen
// True if whether at least no answer has a value that is greater than the enableWhen
// answer.
answer >= it.value
}
Questionnaire.QuestionnaireItemOperator.GREATER_OR_EQUAL -> {
// True if whether at least no answer has a value that is greater or equal to the
// True if whether at least no answer has a value that is greater or equal to the
// enableWhen answer.
answer > it.value
}
Questionnaire.QuestionnaireItemOperator.LESS_THAN -> {
// True if whether at least no answer has a value that is less than the enableWhen
// True if whether at least no answer has a value that is less than the enableWhen
// answer.
answer <= it.value
}
Questionnaire.QuestionnaireItemOperator.LESS_OR_EQUAL -> {
// True if whether at least no answer has a value that is less or equal to the
// True if whether at least no answer has a value that is less or equal to the
// enableWhen answer.
answer < it.value
}
Expand Down