54 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <deque>10 11// Regression test to error in deque::__annotate_from_to in deque,12// with origin in deque::__add_back_capacity.13 14// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support.15// REQUIRES: has-unix-headers16// UNSUPPORTED: c++03, no-localization17 18#include <deque>19#include <cstdio>20#include "check_assertion.h"21 22void test1() {23 std::deque<char> test;24 char buff[100000];25 test.insert(test.begin(), buff, buff + 64000);26 27 for (int i = 0; i < 1100; i += 1) {28 test.insert(test.begin(), buff, buff + 320);29 test.erase(test.end() - 320, test.end());30 }31 32 test.insert(test.begin(), buff, buff + 32000);33}34 35void test2() {36 std::deque<char> test;37 char buff[100000];38 test.insert(test.end(), buff, buff + 64000);39 40 for (int i = 0; i < 1100; i += 1) {41 test.insert(test.end(), buff, buff + 320);42 test.erase(test.begin(), test.begin() + 320);43 }44 45 test.insert(test.end(), buff, buff + 32000);46}47 48int main(int, char**) {49 test1();50 test2();51 52 return 0;53}54