Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
ASSERT - check assertions
Calling Sequence
ASSERT(cond, string)
ASSERT(cond)
Parameters
cond
-
expression evaluating to true or false
string
Description
ASSERT is used to guarantee pre- and post-conditions while a Maple procedure is executing.
If the first argument evaluates to false, an error is generated and the second argument is printed in order to identify the nature of the failure. Such an error cannot be trapped via try-catch.
If the first argument evaluates to true, ASSERT returns NULL.
The ASSERT mechanism can be turned on and off with kernelopts. If turned off, the overhead of processing an ASSERT is negligible.
Thread Safety
The ASSERT command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Examples
Query the current state.
Turn assertions on (kernelopts returns its previous value).
The following results in assertion failures.
Error, assertion failed, x must be an integer
Error, assertion failed, a is too small: 1
This assertion check will succeed.
Assertion failures are not trappable.
Turn assertions off (the previous value is returned again).
Now assertion failures are ignored.
See Also
kernelopts, try
Download Help Document