Skip to content

Commit 476e910

Browse files
committed
Add test case of FP
1 parent d23d3ed commit 476e910

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

cpp/autosar/test/rules/A15-4-4/test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,15 @@ void test_swap_wrapper() noexcept {
4343
int a = 0;
4444
int b = 1;
4545
swap_wrapper(&a, &b);
46+
}
47+
48+
#include <string>
49+
#include <stdexcept>
50+
51+
std::string test_fp_reported_in_424(const std::string &s1, const std::string &s2) {
52+
std::string s3;
53+
s3.reserve(s1.size() + s2.size());
54+
s3.append(s1.c_str(), s1.size());
55+
s3.append(s2.c_str(), s2.size());
56+
return s3;
4657
}

cpp/common/test/includes/standard-library/stdexcept.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ class nested_exception {
2828
template <typename T> [[noreturn]] void throw_with_nested(T &&t);
2929
template <typename E> void rethrow_if_nested(E const &e);
3030

31+
class length_error : public logic_error{};
32+
class out_of_range: public logic_error{};
3133
} // namespace std
3234
#endif // _GHLIBCPP_STDEXCEPT

cpp/common/test/includes/standard-library/string

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ public:
166166
int compare(const charT *s) const;
167167
int compare(size_type pos1, size_type n1, const charT *s) const;
168168
int compare(size_type pos1, size_type n1, const charT *s, size_type n2) const;
169+
170+
void reserve(size_type new_cap = 0);
169171
};
170172

171173
template <class charT, class traits, class Allocator>

0 commit comments

Comments
 (0)