Commit f9d1f4d7 authored by Davis King's avatar Davis King

Added some missing requires clauses and asserts

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402391
parent 697df854
...@@ -43,6 +43,14 @@ namespace dlib ...@@ -43,6 +43,14 @@ namespace dlib
my_tolerance(tolerance_), my_tolerance(tolerance_),
my_max_dictionary_size(max_dictionary_size_) my_max_dictionary_size(max_dictionary_size_)
{ {
// make sure requires clause is not broken
DLIB_ASSERT(tolerance_ >= 0,
"\tkcentroid::kcentroid()"
<< "\n\t You have to give a positive tolerance"
<< "\n\t this: " << this
<< "\n\t tolerance: " << tolerance_
);
clear_dictionary(); clear_dictionary();
} }
......
...@@ -55,6 +55,8 @@ namespace dlib ...@@ -55,6 +55,8 @@ namespace dlib
unsigned long max_dictionary_size_ = 1000000 unsigned long max_dictionary_size_ = 1000000
); );
/*! /*!
requires
- tolerance >= 0
ensures ensures
- this object is properly initialized - this object is properly initialized
- #tolerance() == tolerance_ - #tolerance() == tolerance_
......
...@@ -38,6 +38,14 @@ namespace dlib ...@@ -38,6 +38,14 @@ namespace dlib
my_tolerance(tolerance_), my_tolerance(tolerance_),
my_max_dictionary_size(max_dictionary_size_) my_max_dictionary_size(max_dictionary_size_)
{ {
// make sure requires clause is not broken
DLIB_ASSERT(tolerance_ >= 0,
"\tkrls::krls()"
<< "\n\t You have to give a positive tolerance"
<< "\n\t this: " << this
<< "\n\t tolerance: " << tolerance_
);
clear_dictionary(); clear_dictionary();
} }
......
...@@ -53,6 +53,8 @@ namespace dlib ...@@ -53,6 +53,8 @@ namespace dlib
unsigned long max_dictionary_size_ = 1000000 unsigned long max_dictionary_size_ = 1000000
); );
/*! /*!
requires
- tolerance >= 0
ensures ensures
- this object is properly initialized - this object is properly initialized
- #tolerance() == tolerance_ - #tolerance() == tolerance_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment