package Ġnet . cri ms on wood s . easy databinding . models Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . res . Resources Ċ import Ġandroid . os . Build Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġkotlin . test . Before Test Ċ import Ġkotlin . test . Test Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assert Fails With Ċ import Ġnet . cri ms on wood s . easy databinding . testing . R Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . annotation . Config Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠFloat Test Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġresources : ĠResources ĊĊĠĠĠ Ġ@ Before Test ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġresources Ġ= ĠApplication Provider . getApplicationContext < Context >(). resources ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P , ĠBuild . VERSION _ CODES . Q ]) ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest To Float _ Res () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 0 f , ĠFloat . of ( R . dim en . zero ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 5 f , ĠFloat . of ( R . dim en . zero _ point _ five ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 . 0 f , ĠFloat . of ( R . dim en . one _ point _ zero ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 5 f , ĠFloat . of ( R . dim en . half ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 . 0 f , ĠFloat . of ( R . dim en . full ). toFloat ( resources )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest To Float _ Value () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 0 f , ĠFloat . of ( 0 . 0 f ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 . 5 f , ĠFloat . of ( 0 . 5 f ). toFloat ( resources )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 . 0 f , ĠFloat . of ( 1 . 0 f ). toFloat ( resources )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P , ĠBuild . VERSION _ CODES . Q ]) ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Float _ Res _ InvalidArgument () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Fails With < Resources . NotFoundException > Ġ{ ĠFloat . of ( R . dim en . one _ dp ). toFloat ( resources ) Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With < Resources . NotFoundException > Ġ{ ĠFloat . of ( R . dim en . one _ sp ). toFloat ( resources ) Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With < Resources . NotFoundException > Ġ{ ĠFloat . of ( R . dim en . one _ px ). toFloat ( resources ) Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With < Resources . NotFoundException > Ġ{ ĠFloat . of ( R . dim en . one _ pt ). toFloat ( resources ) Ġ} ĊĠĠĠ Ġ} Ċ } Ċ