test/test_meter_conn_worker/meter_worker_produce_data.cpp
/**
 * Test parsing of an incomplete reading
 */
Test parsing of an incomplete reading
Test parsing of an incomplete reading
void meter_connector_work_full_data_idle_incomplete_only_first(void) {
  StreamString meter_stream;
  meter_stream.print(
      "/XMX5LGBBFG1009321760\r\n"
      "\r\n"
      "1-3:0.2.8(42)\r\n"
      "0-0:1.0.0(200727151422S)\r\n"
      "0-0:96.1.1(4530303331303033323035383733373136)\r\n"
      "1-0:1.8.1(007155.388*kWh)\r\n"
      "1-0:1.8.2(007088.718*kWh)\r\n"
      "1-0:2.8.1(000000.000*kWh)\r\n"
      "1-0:2.8.2(000000.000*kWh)\r\n"
      "0-0:96.14.0(0002)\r\n"
      "1-0:1.7.0(00.276*kW)\r\n"
      "1-0:2.7.0(00.000*kW)\r\n"
      "0-0:96.7.21(00009)\r\n"
      "0-0:96.7.9(00004)\r\n"
  );
  SmartMeterConnector meter_connector(meter_stream);
  meter_connector.set_active(true);
  bool result = meter_connector.work();
  TEST_ASSERT_FALSE(result);
  TEST_ASSERT_EQUAL(meter_connector.get_status(), SmartMeterConnector::Status::e_worker_idle);
  const P1Data& data = meter_connector.get_data();
  TEST_ASSERT_EQUAL(P1Data::k_p1_gathering, data.get_status());
}
void meter_connector_work_full_data_idle_incomplete_only_first ( void ) { StreamString meter_stream ; meter_stream . print ( " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " " \r \n " ) ; SmartMeterConnector meter_connector ( meter_stream ) ; meter_connector . set_active ( true ) ; bool result = meter_connector . work ( ) ; TEST_ASSERT_FALSE ( result ) ; TEST_ASSERT_EQUAL ( meter_connector . get_status ( ) , SmartMeterConnector :: Status :: e_worker_idle ) ; const P1Data & data = meter_connector . get_data ( ) ; TEST_ASSERT_EQUAL ( P1Data :: k_p1_gathering , data . get_status ( ) ) ; }
Test parsing of an incomplete reading
Test parsing of an incomplete reading
// Given // ... "missing" the rest of the lines // When // Then