test/test_meter_conn_worker/meter_worker_produce_data.cpp
/**
 * Test parsing of an invalid reading
 */
Test parsing of an invalid reading
Test parsing of an invalid reading
void meter_connector_work_full_data_fail_invalid_crc(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"
      "1-0:99.97.0(4)(0-0:96.7.19)(180619133556S)(0000000314*s)(180219134256W)(0000000633*s)(180219133039W)(0000007917*s)(160704090617S)(0000004176*s)\r\n"
      "1-0:32.32.0(00000)\r\n"
      "1-0:32.36.0(00000)\r\n"
      "0-0:96.13.1()\r\n"
      "0-0:96.13.0()\r\n"
      "1-0:31.7.0(001*A)\r\n"
      "1-0:21.7.0(00.276*kW)\r\n"
      "1-0:22.7.0(00.000*kW)\r\n"
      "0-1:24.1.0(003)\r\n"
      "0-1:96.1.0(4730303139333430323834343236393136)\r\n"
      "0-1:24.2.1(200727150000S)(06044.581*m3)\r\n"
      "!1627\r\n");
  SmartMeterConnector meter_connector(meter_stream);
  meter_connector.set_active(true);
  bool result = meter_connector.work();
  TEST_ASSERT_FALSE(result);
  TEST_ASSERT_EQUAL(SmartMeterConnector::Status::e_worker_error, meter_connector.get_status());
  const P1Data& data = meter_connector.get_data();
  TEST_ASSERT_EQUAL(P1Data::k_p1_invalid, data.get_status());
}
void meter_connector_work_full_data_fail_invalid_crc ( 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 " " \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 ( SmartMeterConnector :: Status :: e_worker_error , meter_connector . get_status ( ) ) ; const P1Data & data = meter_connector . get_data ( ) ; TEST_ASSERT_EQUAL ( P1Data :: k_p1_invalid , data . get_status ( ) ) ; }
Test parsing of an invalid reading
Test parsing of an invalid reading
// Given // When // Then