19 static void setUp(
void) {
26 static void tearDown(
void) {
35 static void test_GetStatus(
void) {
39 static void test_GetPressureTemperatureBasic(
void) {
51 waitcnt(CLKFREQ / 100 + CNT);
53 TEST_ASSERT_FALSE(sut->
Touch());
62 waitcnt(CLKFREQ / 100 + CNT);
64 TEST_ASSERT_TRUE(sut->
Touch());
74 sut->
Get(pressure, temperature);
82 TEST_ASSERT_TRUE(pressure != 0);
83 TEST_ASSERT_TRUE(temperature != 0);
94 static void test_CalculateHighTemperature(
void) {
102 sut->TEST_SetD(9085466, 8569150);
104 int pressure, temperature;
105 sut->
Get(pressure, temperature);
106 TEST_ASSERT_EQUAL_INT(2007, temperature);
107 TEST_ASSERT_EQUAL_INT(100009, pressure);
111 static void test_SetGetC(
void) {
121 sut->SetC(C[0], C[1], C[2], C[3], C[4], C[5]);
122 sut->GetC(rC[0], rC[1], rC[2], rC[3], rC[4], rC[5]);
124 TEST_ASSERT_EQUAL_INT_ARRAY(C, rC, 6);
127 static void test_GetRaw(
void) {
131 sut->TEST_SetD(D1, D2);
134 sut->
Get(p, t,
false);
136 TEST_ASSERT_EQUAL_INT(D1, p);
137 TEST_ASSERT_EQUAL_INT(D2, t);
140 static void test_GetProccessedIsNotRaw(
void) {
144 sut->TEST_SetD(D1, D2);
149 TEST_ASSERT_FALSE(D1 == p);
150 TEST_ASSERT_FALSE(D2 == t);
153 static void test_TouchTimeoutEffectWhenCalledQuickly(
void) {
154 for (
int i = 0; i < 25; i++) {
155 for (
int j = 0; j < 17; j++) {
156 waitcnt(CLKFREQ / 1000 + CNT);
157 TEST_ASSERT_FALSE(sut->
Touch());
159 waitcnt(CLKFREQ / 1000 + CNT);
160 TEST_ASSERT_TRUE(sut->
Touch());
161 TEST_ASSERT_FALSE(sut->
Touch());
165 static void test_TouchTimeoutHasNoEffectWhenCalledSlowly(
void) {
166 for (
int i = 0; i < 100; i++) {
167 waitcnt(CLKFREQ / 100 + CNT);
168 TEST_ASSERT_FALSE(sut->
Touch());
169 waitcnt(CLKFREQ / 100 + CNT);
170 TEST_ASSERT_TRUE(sut->
Touch());
174 static void test_GetStatusIsFalseForNoBus(
void) {