Added some missing requires clauses and asserts

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402391
This commit is contained in:
Davis King 2008-07-08 03:08:30 +00:00
parent 697df854f9
commit f9d1f4d71e
4 changed files with 20 additions and 0 deletions

View File

@ -43,6 +43,14 @@ namespace dlib
my_tolerance(tolerance_),
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();
}

View File

@ -55,6 +55,8 @@ namespace dlib
unsigned long max_dictionary_size_ = 1000000
);
/*!
requires
- tolerance >= 0
ensures
- this object is properly initialized
- #tolerance() == tolerance_

View File

@ -38,6 +38,14 @@ namespace dlib
my_tolerance(tolerance_),
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();
}

View File

@ -53,6 +53,8 @@ namespace dlib
unsigned long max_dictionary_size_ = 1000000
);
/*!
requires
- tolerance >= 0
ensures
- this object is properly initialized
- #tolerance() == tolerance_