diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt
index 2a66a3470584d14733e8a4651238e13b95756879..bbf634d8fd82d216760824c650d03d3ace687906 100644
--- a/Documentation/Examples/CMakeLists.txt
+++ b/Documentation/Examples/CMakeLists.txt
@@ -11,8 +11,9 @@ target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
 install (TARGETS logger_example DESTINATION share/examples)
 
 add_executable (stack_example stack_example.cc)
+target_compile_options(stack_example PRIVATE -g) # do not skip asserts
 target_link_libraries (stack_example SuperStupidStack CORSIKAunits CORSIKAlogging)
-install (TARGETS stack_example DESTINATION share/examples)
+add_test(stack_example stack_example)
 
 add_executable (cascade_example cascade_example.cc)
 target_link_libraries (cascade_example SuperStupidStack CORSIKAunits CORSIKAlogging
@@ -34,4 +35,3 @@ target_link_libraries (staticsequence_example
   CORSIKAgeometry
   CORSIKAlogging)
 install (TARGETS staticsequence_example DESTINATION share/examples)
-
diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc
index f0a04f79be09dff2c58a74bc4822c443c12061f0..ab9a7655eb4f3baf0f796498918af34925ee1893 100644
--- a/Documentation/Examples/stack_example.cc
+++ b/Documentation/Examples/stack_example.cc
@@ -13,6 +13,7 @@
 #include <corsika/stack/super_stupid/SuperStupidStack.h>
 #include <iomanip>
 #include <iostream>
+#include <cassert>
 
 using namespace std;
 // using namespace corsika::literals;
@@ -30,14 +31,18 @@ void fill(corsika::stack::super_stupid::SuperStupidStack& s) {
 }
 
 void read(corsika::stack::super_stupid::SuperStupidStack& s) {
-  cout << "found Stack with " << s.GetSize() << " particles. " << endl;
-  EnergyType Etot;
+  assert(s.GetSize() == 11);  // stack has 11 particles
+
+  EnergyType total_energy;
+  int i = 0;
   for (auto& p : s) {
-    Etot += p.GetEnergy();
-    cout << "particle: " << p.GetPID() << " with " << p.GetEnergy() / 1_GeV << " GeV"
-         << endl;
+    total_energy += p.GetEnergy();
+    // particles are electrons with 1.5 GeV energy times i
+    assert(p.GetPID() == corsika::particles::Code::Electron);
+    assert(p.GetEnergy() == i++ * 1_GeV);
   }
-  cout << "Etot=" << Etot << " = " << Etot / 1_GeV << " GeV" << endl;
+
+  assert(total_energy == 16.5_GeV);
 }
 
 int main() {