This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new e50627ecd apps/testing:Add c++ STL code size test case.
e50627ecd is described below

commit e50627ecd6446ef7531f15ba59006ebc4dc8e192
Author: cuiziwei <[email protected]>
AuthorDate: Wed Aug 7 22:29:57 2024 +0800

    apps/testing:Add c++ STL code size test case.
    
    Signed-off-by: cuiziwei <[email protected]>
---
 testing/cxxsize/CMakeLists.txt         |  37 +++++++++++
 testing/cxxsize/Kconfig                |   9 +++
 testing/cxxsize/Make.defs              |  23 +++++++
 testing/cxxsize/Makefile               |  32 ++++++++++
 testing/cxxsize/README.md              | 109 +++++++++++++++++++++++++++++++++
 testing/cxxsize/array.cxx              |  51 +++++++++++++++
 testing/cxxsize/condition_variable.cxx |  61 ++++++++++++++++++
 testing/cxxsize/deque.cxx              |  60 ++++++++++++++++++
 testing/cxxsize/exception.cxx          |  62 +++++++++++++++++++
 testing/cxxsize/forward_list.cxx       |  58 ++++++++++++++++++
 testing/cxxsize/future.cxx             |  53 ++++++++++++++++
 testing/cxxsize/iostream.cxx           |  56 +++++++++++++++++
 testing/cxxsize/list.cxx               |  60 ++++++++++++++++++
 testing/cxxsize/map.cxx                |  64 +++++++++++++++++++
 testing/cxxsize/multiset.cxx           |  63 +++++++++++++++++++
 testing/cxxsize/mutex.cxx              |  54 ++++++++++++++++
 testing/cxxsize/rtti.cxx               |  66 ++++++++++++++++++++
 testing/cxxsize/semaphore.cxx          |  51 +++++++++++++++
 testing/cxxsize/set.cxx                |  63 +++++++++++++++++++
 testing/cxxsize/shared_ptr.cxx         |  60 ++++++++++++++++++
 testing/cxxsize/string.cxx             |  64 +++++++++++++++++++
 testing/cxxsize/string_view.cxx        |  56 +++++++++++++++++
 testing/cxxsize/thread.cxx             |  61 ++++++++++++++++++
 testing/cxxsize/unordered_map.cxx      |  65 ++++++++++++++++++++
 testing/cxxsize/unordered_multimap.cxx |  63 +++++++++++++++++++
 testing/cxxsize/unordered_multiset.cxx |  63 +++++++++++++++++++
 testing/cxxsize/unordered_set.cxx      |  63 +++++++++++++++++++
 testing/cxxsize/vector.cxx             |  59 ++++++++++++++++++
 testing/cxxsize/weak_ptr.cxx           |  68 ++++++++++++++++++++
 29 files changed, 1654 insertions(+)

diff --git a/testing/cxxsize/CMakeLists.txt b/testing/cxxsize/CMakeLists.txt
new file mode 100644
index 000000000..6588f089b
--- /dev/null
+++ b/testing/cxxsize/CMakeLists.txt
@@ -0,0 +1,37 @@
+# 
##############################################################################
+# apps/testing/cxxsize/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may 
not
+# use this file except in compliance with the License.  You may obtain a copy 
of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# 
##############################################################################
+
+if(CONFIG_TESTING_CXXSIZE)
+  file(GLOB SOURCES "*.cxx")
+
+  foreach(src ${SOURCES})
+    get_filename_component(name ${src} NAME_WE)
+    nuttx_add_application(
+      NAME
+      ${name}
+      STACKSIZE
+      ${CONFIG_DEFAULT_TASK_STACKSIZE}
+      MODULE
+      ${CONFIG_TESTING_CXXSIZE}
+      SRCS
+      ${src})
+  endforeach()
+
+endif()
diff --git a/testing/cxxsize/Kconfig b/testing/cxxsize/Kconfig
new file mode 100644
index 000000000..976113c90
--- /dev/null
+++ b/testing/cxxsize/Kconfig
@@ -0,0 +1,9 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config TESTING_CXXSIZE
+       tristate "Test c++ code size program"
+       default n
+       depends on HAVE_CXX
diff --git a/testing/cxxsize/Make.defs b/testing/cxxsize/Make.defs
new file mode 100644
index 000000000..6dcca3b48
--- /dev/null
+++ b/testing/cxxsize/Make.defs
@@ -0,0 +1,23 @@
+############################################################################
+# apps/testing/cxxtest/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+ifneq ($(CONFIG_TESTING_CXXSIZE),)
+CONFIGURED_APPS += $(APPDIR)/testing/cxxsize
+endif
diff --git a/testing/cxxsize/Makefile b/testing/cxxsize/Makefile
new file mode 100644
index 000000000..b822abfde
--- /dev/null
+++ b/testing/cxxsize/Makefile
@@ -0,0 +1,32 @@
+############################################################################
+# apps/testing/cxxtest/Makefile
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# CXX code test program
+
+MAINSRC := $(wildcard *.cxx)
+PROGNAME := $(patsubst %.cxx,%, $(wildcard *.cxx))
+
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
+MODULE = $(CONFIG_TESTING_CXXSIZE)
+
+include $(APPDIR)/Application.mk
diff --git a/testing/cxxsize/README.md b/testing/cxxsize/README.md
new file mode 100644
index 000000000..aefe6a04e
--- /dev/null
+++ b/testing/cxxsize/README.md
@@ -0,0 +1,109 @@
+# C++ Standard Library Code Size Testing Program
+
+## Introduction
+
+This project provides a testing program designed to measure the code size of 
each class in the C++ Standard Library. Understanding the code size of various 
classes can help developers optimize their usage of the standard library and 
make informed design decisions in their applications. This program aims to 
provide clear insights into how much memory each component of the standard 
library consumes, categorized into text, data, BSS, and overall size (DEC).
+
+## Purpose
+
+The primary goals of this project are to:
+- **Analyze the memory consumption** of standard library components.
+- **Identify potential areas for optimization** in applications that utilize 
these components.
+- **Aid developers** in making better decisions regarding the use of the C++ 
Standard Library depending on their application’s constraints.
+
+## Testing Platform
+This program has been tested on the x4b/release branch.
+
+## C++ Compilation Configurations
+
+- `CONFIG_HAVE_CXX`
+- `CONFIG_HAVE_CXXINITIALIZE`
+- `CONFIG_LIBCXX`
+- `CONFIG_LIBSUPCXX`
+
+## Optimization Configurations
+
+- `CONFIG_DEBUG_OPTLEVEL="-Os"`
+- `CONFIG_LTO_FULL`
+- `-ffunction-section`
+- `-fdata-section`
+
+## Component-Specific Configurations
+
+- **`iostream`**: enable `CONFIG_LIBC_LOCALE`.
+- **`exception`**: enable `CONFIG_CXX_EXCEPTION`.
+- **`rtti`**: enable `CONFIG_CXX_RTTI`.
+
+## Compilation Instructions
+
+To compile the code size testing program, use the following command:
+
+```bash
+./build.sh qemu-armv7a:nsh -j
+```
+
+## Code Size Breakdown
+
+The following table summarizes the code size measurements for different 
components in the C++ Standard Library. The sizes are measured in bytes and 
broken down into the following categories:
+
+- **Text**: Size of the code segment containing executable instructions.
+- **Data**: Size of initialized global and static variables.
+- **BSS**: Size of uninitialized global and static variables.
+- **DEC**: Total size in bytes (sum of Text, Data, and BSS).
+
+### Output Examples
+
+#### Without C++ Config
+
+```
+   text    data     bss     dec     hex filename
+ 204388     300    9728  214416   34590 nuttx/nuttx
+```
+
+#### Only Basic C++ Configurations
+
+```
+   text    data     bss     dec     hex filename
+ 208100     300    9856  218256   35490 nuttx/nuttx
+```
+
+#### Compiling an Empty main Function with Basic C++ Configurations
+
+```
+   text    data     bss     dec     hex filename
+ 208132     300    9856  218288   354b0 nuttx/nuttx
+```
+
+### Code Size Measurements
+
+| **Component**        | **Text** | **Data** | **BSS** | **DEC** |
+| ---------------------|---------|---------|---------|--------|
+| basic c++            | 3712    | 0       | 128     | 3840   |
+| array                | 32      | 0       | 0       | 32     |
+| condition_variable   | 584     | 8       | 16      | 608    |
+| deque                | 41196   | 300     | 40      | 41544  |
+| exception            | 32      | 0       | 32      | 32     |
+| forward_list         | 41164   | 308     | 40      | 41512  |
+| future               | 43504   | 356     | 112     | 43972  |
+| iostream             | 148004  | 404     | 3160    | 151568 |
+| list                 | 41516   | 308     | 40      | 41864  |
+| map                  | 45252   | 308     | 40      | 45600  |
+| multiset             | 44676   | 308     | 40      | 45024  |
+| mutex                | 552     | 8       | 16      | 576    |
+| rtti                 | 41420   | 308     | 40      | 41768  |
+| semaphore            | 1352    | 8       | 16488   | 17808  |
+| set                  | 44644   | 308     | 40      | 44992  |
+| shared_ptr           | 43204   | 308     | 40      | 41712  |
+| string               | 42044   | 308     | 40      | 42392  |
+| string_view          | 448     | 0       | 0       | 448    |
+| thread               | 41956   | 356     | 12      | 42424  |
+| unordered_map        | 47668   | 308     | 40      | 48016  |
+| unordered_multimap   | 46868   | 308     | 40      | 47216  |
+| unordered_multiset   | 46836   | 308     | 40      | 47184  |
+| unordered_set        | 46452   | 308     | 40      | 46800  |
+| vector               | 41444   | 308     | 40      | 41792  |
+| weak_ptr             | 43460   | 308     | 40      | 41936  |
+
+## Conclusion
+
+By analyzing the code size of each component in the C++ Standard Library, 
developers can better understand the memory implications of their usage of 
these classes. The details provided in this README serve as a reference point 
for optimizing application performance and making educated design choices. We 
hope you find this information valuable as you work with the C++ Standard 
Library.
diff --git a/testing/cxxsize/array.cxx b/testing/cxxsize/array.cxx
new file mode 100644
index 000000000..13b3730c6
--- /dev/null
+++ b/testing/cxxsize/array.cxx
@@ -0,0 +1,51 @@
+//***************************************************************************
+// apps/testing/cxxsize/array.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <array>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: array_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::array<int, 3> arr;
+
+  arr = { 1, 2, 3 };
+  arr[1] = 4;
+
+  return 0;
+}
diff --git a/testing/cxxsize/condition_variable.cxx 
b/testing/cxxsize/condition_variable.cxx
new file mode 100644
index 000000000..2b9b2e188
--- /dev/null
+++ b/testing/cxxsize/condition_variable.cxx
@@ -0,0 +1,61 @@
+//***************************************************************************
+// apps/testing/cxxsize/condition_variable.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <condition_variable>
+#include <mutex>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: condition_variable_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  bool ready = false;
+  std::condition_variable cv;
+  std::mutex mtx;
+
+  {
+    std::lock_guard<std::mutex> lock(mtx);
+    ready = true;
+  }
+
+  cv.notify_one();
+
+  std::unique_lock<std::mutex> lock(mtx);
+  cv.wait(lock, [&ready] { return ready; });
+
+  return 0;
+}
diff --git a/testing/cxxsize/deque.cxx b/testing/cxxsize/deque.cxx
new file mode 100644
index 000000000..a50309e57
--- /dev/null
+++ b/testing/cxxsize/deque.cxx
@@ -0,0 +1,60 @@
+//***************************************************************************
+// apps/testing/cxxsize/deque.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <deque>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: deque_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::deque<int> deq;
+
+  deq.push_back(1);
+  deq.push_back(2);
+  deq.pop_back();
+
+  deq.push_front(3);
+  deq.pop_front();
+
+  deq.insert(deq.begin(), 4);
+  deq.erase(deq.begin());
+
+  deq.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/exception.cxx b/testing/cxxsize/exception.cxx
new file mode 100644
index 000000000..2e0a66ab5
--- /dev/null
+++ b/testing/cxxsize/exception.cxx
@@ -0,0 +1,62 @@
+//***************************************************************************
+// apps/testing/cxxsize/exception.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#ifdef CONFIG_CXX_EXCEPTION
+#include <stdexcept>
+#endif
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: exception_main
+//***************************************************************************/
+
+extern "C" int main(int argc, char *argv[])
+{
+#ifdef CONFIG_CXX_EXCEPTION
+  try
+    {
+      throw std::runtime_error("runtime error");
+    }
+  catch (std::runtime_error &e)
+    {
+      if (e.what())
+        {
+          return 0;
+        }
+    }
+#endif
+
+  return 1;
+}
diff --git a/testing/cxxsize/forward_list.cxx b/testing/cxxsize/forward_list.cxx
new file mode 100644
index 000000000..9488b84cf
--- /dev/null
+++ b/testing/cxxsize/forward_list.cxx
@@ -0,0 +1,58 @@
+//***************************************************************************
+// apps/testing/cxxsize/forward_list.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <forward_list>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: forward_list_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::forward_list<int> l;
+
+  l.push_front(1);
+  l.push_front(2);
+  l.push_front(3);
+  l.pop_front();
+
+  l.insert_after(l.begin(), 4);
+  l.erase_after(l.begin());
+
+  l.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/future.cxx b/testing/cxxsize/future.cxx
new file mode 100644
index 000000000..3c09862f2
--- /dev/null
+++ b/testing/cxxsize/future.cxx
@@ -0,0 +1,53 @@
+//***************************************************************************
+// apps/testing/cxxsize/future.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <future>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: future_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::future<int> f = std::async(std::launch::async, []() { return 42; });
+
+  if (f.get())
+    {
+        return 1;
+    }
+
+  return 0;
+}
diff --git a/testing/cxxsize/iostream.cxx b/testing/cxxsize/iostream.cxx
new file mode 100644
index 000000000..038344f5c
--- /dev/null
+++ b/testing/cxxsize/iostream.cxx
@@ -0,0 +1,56 @@
+//***************************************************************************
+// apps/testing/cxxsize/iostream.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <iostream>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: iostream_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  int num;
+
+  std::cout << "Enter:";
+  std::cin >> num;
+
+  if (std::cin.fail())
+    {
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/testing/cxxsize/list.cxx b/testing/cxxsize/list.cxx
new file mode 100644
index 000000000..fa389828b
--- /dev/null
+++ b/testing/cxxsize/list.cxx
@@ -0,0 +1,60 @@
+//***************************************************************************
+// apps/testing/cxxsize/list.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <list>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: list_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::list<int> l;
+
+  l.push_back(1);
+  l.push_back(2);
+  l.pop_back();
+
+  l.push_front(3);
+  l.pop_front();
+
+  l.insert(l.begin(), 4);
+  l.erase(l.begin());
+
+  l.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/map.cxx b/testing/cxxsize/map.cxx
new file mode 100644
index 000000000..5f0f55b54
--- /dev/null
+++ b/testing/cxxsize/map.cxx
@@ -0,0 +1,64 @@
+//***************************************************************************
+// apps/testing/cxxsize/map.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <map>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: map_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::map<int, int> m;
+
+  m = {{ 1, 1 }, { 2, 2 }};
+  m[3] = 3;
+
+  if (m.find(1) != m.end())
+    {
+      m.erase(1);
+    }
+
+  while (!m.empty())
+    {
+      m.erase(m.begin());
+    }
+
+  m.insert({4, 4});
+  m.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/multiset.cxx b/testing/cxxsize/multiset.cxx
new file mode 100644
index 000000000..5ad8eefa5
--- /dev/null
+++ b/testing/cxxsize/multiset.cxx
@@ -0,0 +1,63 @@
+//***************************************************************************
+// apps/testing/cxxsize/multiset.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <set>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: multiset_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::multiset<int> s;
+
+  s = { 1, 2, 2 };
+
+  if (s.find(1) != s.end())
+    {
+      s.erase(1);
+    }
+
+  while (!s.empty())
+    {
+      s.erase(s.begin());
+    }
+
+  s.insert(4);
+  s.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/mutex.cxx b/testing/cxxsize/mutex.cxx
new file mode 100644
index 000000000..e831c7dcd
--- /dev/null
+++ b/testing/cxxsize/mutex.cxx
@@ -0,0 +1,54 @@
+//***************************************************************************
+// apps/testing/cxxsize/mutex.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <mutex>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: set_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::mutex mtx;
+
+  mtx.lock();
+  mtx.unlock();
+
+  mtx.try_lock();
+  mtx.unlock();
+
+  return 0;
+}
diff --git a/testing/cxxsize/rtti.cxx b/testing/cxxsize/rtti.cxx
new file mode 100644
index 000000000..47a574838
--- /dev/null
+++ b/testing/cxxsize/rtti.cxx
@@ -0,0 +1,66 @@
+//***************************************************************************
+// apps/testing/cxxsize/rtti.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <typeinfo>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+class Base
+{
+public:
+  virtual ~Base() {}
+};
+
+class Derived : public Base {};
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: rtti_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  Base* basePtr = new Derived();
+  Derived* derivedPtr = dynamic_cast<Derived*>(basePtr);
+
+  if (derivedPtr)
+    {
+      delete basePtr;
+      return 0;
+    }
+  else
+    {
+      delete basePtr;
+      return 1;
+    }
+}
diff --git a/testing/cxxsize/semaphore.cxx b/testing/cxxsize/semaphore.cxx
new file mode 100644
index 000000000..379f08fb4
--- /dev/null
+++ b/testing/cxxsize/semaphore.cxx
@@ -0,0 +1,51 @@
+//***************************************************************************
+// apps/testing/cxxsize/semaphore.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <semaphore>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: semaphore_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::counting_semaphore sem(0);
+
+  sem.release();
+  sem.acquire();
+
+  return 0;
+}
diff --git a/testing/cxxsize/set.cxx b/testing/cxxsize/set.cxx
new file mode 100644
index 000000000..7e9b6bded
--- /dev/null
+++ b/testing/cxxsize/set.cxx
@@ -0,0 +1,63 @@
+//***************************************************************************
+// apps/testing/cxxsize/set.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <set>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: set_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::set<int> s;
+
+  s = { 1, 2, 3 };
+
+  if (s.find(1) != s.end())
+    {
+      s.erase(1);
+    }
+
+  while (!s.empty())
+    {
+      s.erase(s.begin());
+    }
+
+  s.insert(4);
+  s.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/shared_ptr.cxx b/testing/cxxsize/shared_ptr.cxx
new file mode 100644
index 000000000..9d2defaf6
--- /dev/null
+++ b/testing/cxxsize/shared_ptr.cxx
@@ -0,0 +1,60 @@
+//***************************************************************************
+// apps/testing/cxxsize/shared_ptr.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <memory>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: shared_ptr_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::shared_ptr<int> ptr(new int(10));
+
+  if(ptr == nullptr)
+    {
+      return 1;
+    }
+
+  ptr.reset();
+
+  if (ptr.use_count())
+    {
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/testing/cxxsize/string.cxx b/testing/cxxsize/string.cxx
new file mode 100644
index 000000000..3ad0d005e
--- /dev/null
+++ b/testing/cxxsize/string.cxx
@@ -0,0 +1,64 @@
+//***************************************************************************
+// apps/testing/cxxsize/string.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <string>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: string_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::string str = "hello world";
+
+  str.push_back(' ');
+  str.pop_back();
+
+  if (str.find('h'))
+    {
+      str.erase(2, 3);
+    }
+
+  while (!str.empty())
+    {
+      str.erase(str.begin());
+    }
+
+  str.append("world");
+  str.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/string_view.cxx b/testing/cxxsize/string_view.cxx
new file mode 100644
index 000000000..07f7fb9f5
--- /dev/null
+++ b/testing/cxxsize/string_view.cxx
@@ -0,0 +1,56 @@
+//***************************************************************************
+// apps/testing/cxxsize/string_view.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <string>
+#include <string_view>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: string_view_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  char str[] = "hello world";
+  std::string_view sv = str;
+
+  size_t pos = sv.find("world");
+  if (pos != std::string_view::npos)
+    {
+      return 0;
+    }
+
+  return 1;
+}
diff --git a/testing/cxxsize/thread.cxx b/testing/cxxsize/thread.cxx
new file mode 100644
index 000000000..98ed6157e
--- /dev/null
+++ b/testing/cxxsize/thread.cxx
@@ -0,0 +1,61 @@
+//***************************************************************************
+// apps/testing/cxxsize/thread.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <thread>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: thread_function
+//***************************************************************************/
+
+void thread_function()
+{
+}
+
+//***************************************************************************
+// Name: thread_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::thread threads(thread_function);
+
+  if (threads.joinable())
+    {
+      threads.join();
+    }
+
+  return 0;
+}
diff --git a/testing/cxxsize/unordered_map.cxx 
b/testing/cxxsize/unordered_map.cxx
new file mode 100644
index 000000000..8b1a5e1bd
--- /dev/null
+++ b/testing/cxxsize/unordered_map.cxx
@@ -0,0 +1,65 @@
+//***************************************************************************
+// apps/testing/cxxsize/unordered_map.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <unordered_map>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: unordered_map_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::unordered_map<int, int> m;
+
+  m = {{ 1, 1 }, { 2, 2 }};
+  m[3] = 3;
+
+  if (m.find(1) != m.end())
+    {
+      m.erase(1);
+    }
+
+  while (!m.empty())
+    {
+      m.erase(m.begin());
+    }
+
+  m.insert({4, 4});
+  m.clear();
+
+  return 0;
+}
+
diff --git a/testing/cxxsize/unordered_multimap.cxx 
b/testing/cxxsize/unordered_multimap.cxx
new file mode 100644
index 000000000..50034714e
--- /dev/null
+++ b/testing/cxxsize/unordered_multimap.cxx
@@ -0,0 +1,63 @@
+//***************************************************************************
+// apps/testing/cxxsize/unordered_multimap.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <unordered_map>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: unordered_multimap_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::unordered_multimap<int, int> m;
+
+  m = {{ 1, 1 }, { 2, 2 }, { 2, 3 }};
+
+  if (m.find(1) != m.end())
+    {
+      m.erase(1);
+    }
+
+  while (!m.empty())
+    {
+      m.erase(m.begin());
+    }
+
+  m.insert({4, 4});
+  m.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/unordered_multiset.cxx 
b/testing/cxxsize/unordered_multiset.cxx
new file mode 100644
index 000000000..ecdf7787c
--- /dev/null
+++ b/testing/cxxsize/unordered_multiset.cxx
@@ -0,0 +1,63 @@
+//***************************************************************************
+// apps/testing/cxxsize/unordered_multiset.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <unordered_set>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: unordered_multiset_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::unordered_multiset<int> s;
+
+  s = { 1, 2, 2 };
+
+  if (s.find(1) != s.end())
+    {
+      s.erase(1);
+    }
+
+  while (!s.empty())
+    {
+      s.erase(s.begin());
+    }
+
+  s.insert(3);
+  s.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/unordered_set.cxx 
b/testing/cxxsize/unordered_set.cxx
new file mode 100644
index 000000000..5ce56f6e7
--- /dev/null
+++ b/testing/cxxsize/unordered_set.cxx
@@ -0,0 +1,63 @@
+//***************************************************************************
+// apps/testing/cxxsize/unordered_set.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <unordered_set>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: unordered_set_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::unordered_set<int> s;
+
+  s = { 1, 2, 3 };
+
+  if (s.find(1) != s.end())
+    {
+      s.erase(1);
+    }
+
+  while (!s.empty())
+    {
+      s.erase(s.begin());
+    }
+
+  s.insert(4);
+  s.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/vector.cxx b/testing/cxxsize/vector.cxx
new file mode 100644
index 000000000..a2182b3ce
--- /dev/null
+++ b/testing/cxxsize/vector.cxx
@@ -0,0 +1,59 @@
+//***************************************************************************
+// apps/testing/cxxsize/vector.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <vector>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: vector_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::vector<int> vec;
+
+  vec.push_back(1);
+  vec.push_back(2);
+  vec.push_back(3);
+
+  vec.pop_back();
+
+  vec.insert(vec.begin(), 4);
+  vec.erase(vec.begin());
+
+  vec.clear();
+
+  return 0;
+}
diff --git a/testing/cxxsize/weak_ptr.cxx b/testing/cxxsize/weak_ptr.cxx
new file mode 100644
index 000000000..d93e6b917
--- /dev/null
+++ b/testing/cxxsize/weak_ptr.cxx
@@ -0,0 +1,68 @@
+//***************************************************************************
+// apps/testing/cxxsize/weak_ptr.cxx
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.  The
+// ASF licenses this file to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance with the
+// License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations
+// under the License.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <memory>
+
+//***************************************************************************
+// Private Classes
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+//***************************************************************************
+// Public Functions
+//***************************************************************************
+
+//***************************************************************************
+// Name: weak_ptr_main
+//***************************************************************************/
+
+extern "C" int main(int argc, FAR char *argv[])
+{
+  std::weak_ptr<int> weak_ptr;
+  std::shared_ptr<int> shared_ptr(new int(10));
+
+  weak_ptr = shared_ptr;
+
+  if (weak_ptr.expired())
+    {
+      return 1;
+    }
+
+  if (weak_ptr.lock() != shared_ptr)
+    {
+      return 1;
+    }
+
+  shared_ptr.reset();
+
+  if (weak_ptr.use_count())
+    {
+      return 1;
+    }
+
+  return 0;
+}

Reply via email to