text: // Copyright 2019 The Fuchsia Authors. All rights reserved.
  // Use of this source code is governed by a BSD-style license that can be
  // found in the LICENSE file.
  
  #include <zxtest/zxtest.h>
  #include "smbios.h"
  
  // This is needed because smbios.cpp uses get_root_resource() for some of the
  // driver functionality (in that case, it comes from the devhost).  Since this
  // test binary is a standalone executable, we need something to define this
  // symbol.  On a build that GCs symbols, this will likely be omitted.
  extern "C" zx_handle_t get_root_resource() { return ZX_HANDLE_INVALID; }
  
  TEST(SmbiosTestCase, ProductNameAllSpaces) {
    char buf[32] = {};
    memset(buf, ' ', sizeof(buf) - 1);
    while (strlen(buf) > 0) {
      ASSERT_FALSE(smbios_product_name_is_valid(buf));
      buf[strlen(buf) - 1] = 0;
    }
  }
  
  TEST(SmbiosTestCase, ProductNameEmpty) { ASSERT_FALSE(smbios_product_name_is_valid("")); }
  
  TEST(SmbiosTestCase, ProductNameNull) {
    ASSERT_FALSE(smbios_product_name_is_valid(nullptr));
    ASSERT_FALSE(smbios_product_name_is_valid("<null>"));
  }
  
  TEST(SmbiosTestCase, ProductNameValid) {
    ASSERT_TRUE(smbios_product_name_is_valid("NUC6i3SYB"));
    ASSERT_TRUE(smbios_product_name_is_valid("Test Name"));
  }
  