#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for create_unwind_table.py.

This test suite contains tests for the custom unwind table creation for 32-bit
arm builds.
"""

import io
import struct

import unittest
import unittest.mock
import re

from create_unwind_table import (
    AddressCfi, AddressUnwind, FilterToNonTombstoneCfi, FunctionCfi,
    FunctionUnwind, EncodeAddressUnwind, EncodeAddressUnwinds,
    EncodedAddressUnwind, EncodeAsBytes, EncodeFunctionOffsetTable,
    EncodedFunctionUnwind, EncodeFunctionUnwinds, EncodeStackPointerUpdate,
    EncodePop, EncodePageTableAndFunctionTable, EncodeUnwindInstructionTable,
    GenerateUnwinds, NullParser, ParseAddressCfi, PushOrSubSpParser,
    ReadFunctionCfi, REFUSE_TO_UNWIND, StoreSpParser, TRIVIAL_UNWIND,
    Uleb128Encode, UnwindInstructionsParser, UnwindType, VPushParser)


class _TestReadFunctionCfi(unittest.TestCase):
  def testFilterTombstone(self):
    input_lines = [
        'file name',
        'STACK CFI INIT 0 ',
        'STACK CFI 100 ',
        'STACK CFI INIT 1 ',
        'STACK CFI 200 ',
    ]