def testGenerateHeaderFileContentEmptyArray(self):
   header_filename = "test/test.h"
   namespace = "some_namespace"
   content = generate_expired_histograms_array._GenerateHeaderFileContent(
       header_filename, namespace, dict())
   self.assertEqual(_EXPECTED_HEADER_FILE_CONTENT.format(
       array_definition=_EXPECTED_EMPTY_ARRAY_DEFINITION), content)
  def testGenerateHeaderFileContent(self):
    header_filename = "test/test.h"
    namespace = "some_namespace"

    histogram_map = generate_expired_histograms_array._GetHashToNameMap(
        ["Test.FirstHistogram", "Test.SecondHistogram"])
    expected_histogram_map = {
        "0x965ce8e9e12a9c89": "Test.FirstHistogram",
        "0xdb5b2f55ffd139e8": "Test.SecondHistogram",
    }
    self.assertEqual(expected_histogram_map, histogram_map)

    content = generate_expired_histograms_array._GenerateHeaderFileContent(
        header_filename, namespace, histogram_map)

    self.assertEqual(_EXPECTED_HEADER_FILE_CONTENT.format(
        array_definition=_EXPECTED_NON_EMPTY_ARRAY_DEFINITION), content)
  def testGenerateHeaderFileContent(self):
    header_filename = "test/test.h"
    namespace = "some_namespace"

    histogram_map = generate_expired_histograms_array._GetHashToNameMap(
        ["Back", "NewTab", "Forward"])
    expected_histogram_map = {
        "0x0557fa92": "Back",
        "0x290eb683": "NewTab",
        "0x67d2f674": "Forward",
    }
    self.assertEqual(expected_histogram_map, histogram_map)

    content = generate_expired_histograms_array._GenerateHeaderFileContent(
        header_filename, namespace, histogram_map)

    self.assertEqual(_EXPECTED_HEADER_FILE_CONTENT.format(
        array_definition=_EXPECTED_NON_EMPTY_ARRAY_DEFINITION), content)