Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions TestConcoreHpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ static void test_default_maxtime_reads_file() {
rm("in1/concore.maxtime");
}

static void test_default_maxtime_keeps_fraction() {
setup_dirs();
write_file("in1/concore.maxtime", "2.5");

Concore c;
c.delay = 0;
c.default_maxtime(100);

check("default_maxtime from file==2.5", c.maxtime == 2.5);

rm("in1/concore.maxtime");
}

static void test_default_maxtime_fallback() {
rm("in1/concore.maxtime");

Expand Down Expand Up @@ -392,6 +405,7 @@ int main() {

// default_maxtime()
test_default_maxtime_reads_file();
test_default_maxtime_keeps_fraction();
test_default_maxtime_fallback();

// tryparam()
Expand Down
8 changes: 4 additions & 4 deletions concore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Concore{
double delay = 1;
int retrycount = 0;
double simtime;
int maxtime = 100;
double maxtime = 100;
map <string, int> iport;
map <string, int> oport;
map <string, string> params;
Expand Down Expand Up @@ -1125,9 +1125,9 @@ class Concore{
* @brief Sets maxtime from the concore.maxtime file, falling back to defaultValue.
* @param defaultValue The fallback value if the file is missing.
*/
void default_maxtime(int defaultValue){
maxtime = (int)concore_base::load_maxtime(
inpath + "1/concore.maxtime", (double)defaultValue);
void default_maxtime(double defaultValue){
maxtime = concore_base::load_maxtime(
inpath + "1/concore.maxtime", defaultValue);
}

/**
Expand Down
Loading