# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
-SHORT_NAMES = NO
+SHORT_NAMES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007, 2008 Muneyuki Noguchi
+ * Copyright (C) 2007, 2008, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
const double Fit::DEFAULT_FIT_LIMIT = 1e-5;
-Fit::Fit() : functionName_("f(x)"),
+Fit::Fit() : functionName_("f(x)"), isParameterFile_(true),
fitLimit_(DEFAULT_FIT_LIMIT), fitMaxIter_(DEFAULT_FIT_MAX_ITER)
{
}
commandList << "FIT_MAXITER = " + QString::number(fitMaxIter_);
}
commandList << functionName_ + '=' + function_;
- QString str = "fit " + range_.option() + ' ' + functionName_ + " '"
- + dataFile_ + "' " + dataFileModifier_.option() + " via ";
+ QString str = "fit " + range_.option() + functionName_ + " '"
+ + dataFile_ + "' " + dataFileModifier_.option() + "via ";
if (isParameterFile_) {
str += '\'' + parameterFile_ + '\'';
} else {
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
public:
Fit();
+ /*!
+ * \brief フィッティングする範囲を設定する
+ * \param range フィッティングする設定する範囲
+ */
void setRange(const FitRange &range);
+ /*!
+ * \brief フィッティングする範囲を得る
+ * \return フィッティングする範囲
+ */
const FitRange &range() const;
+ /*!
+ * \brief フィッティングに用いる関数の名前を設定する
+ * \param functionName フィッティングに用いる関数の名前
+ */
void setFunctionName(const QString &functionName);
+ /*!
+ * \brief フィッティングに用いる関数の名前を得る
+ * \return フィッティングに用いる関数の名前
+ */
const QString &functionName() const;
+ /*!
+ * \brief フィッティングに用いる関数の定義を設定する
+ * \param function フィッティングに用いる関数の定義
+ */
void setFunction(const QString &function);
+ /*!
+ * \brief フィッティングに用いる関数の定義を得る
+ * \return フィッティングに用いる関数の定義
+ */
const QString &function() const;
+ /*!
+ * \brief フィッティングに用いるデータファイルの名前を設定する
+ * \param file フィッティングに用いるデータファイルの名前
+ */
void setDataFile(const QString &file);
+ /*!
+ * \brief フィッティングに用いるデータファイルの名前を得る
+ * \return フィッティングに用いるデータファイルの名前
+ */
const QString &dataFile() const;
+ /*!
+ * \brief データファイルの修飾子を設定する
+ * \param mod 設定するデータファイルの修飾子
+ */
void setDataFileModifier(const FitModifier &mod);
+ /*!
+ * \brief データファイルの修飾子を得る
+ * \return データファイルの修飾子
+ */
const FitModifier &dataFileModifier() const;
+ /*!
+ * \brief ファイルでパラメータを指定するかどうかを設定する
+ * \param isFile ファイルでパラメータを指定するかどうか
+ */
void setParameterFile(bool isFile);
+ /*!
+ * \brief ファイルでパラメータを指定するかどうかを返す
+ * \return ファイルでパラメータを指定するならば true
+ */
bool isParameterFile() const;
+ /*!
+ * \brief パラメータファイルの名前を設定する
+ * \param file 設定するパラメータファイルの名前
+ */
void setParameterFile(const QString &file);
+ /*!
+ * \brief パラメータファイルの名前を得る
+ * \return パラメータファイルの名前
+ */
const QString ¶meterFile() const;
+ /*!
+ * \brief パラメータ変数の名前を設定する
+ * \return 設定するパラメータ変数の名前
+ */
void setVariable(const QStringList &var);
+ /*!
+ * \brief パラメータ変数の名前を設定する
+ * \return パラメータ変数の名前
+ */
const QStringList &variable() const;
+ /*!
+ * \brief フィッティングの限界を設定する
+ * \param limit 設定するフィッティングの限界
+ */
void setFitLimit(double limit);
+ /*!
+ * \brief フィッティングの限界を得る
+ * \return フィッティングの限界
+ */
double fitLimit() const;
+ /*!
+ * \brief フィッティングの最大繰り返し数を指定する
+ * \param iter 設定するフィッティングの最大繰り返し数
+ */
void setFitMaxIter(int iter);
+ /*!
+ * \brief フィッティングの最大繰り返し数を得る
+ * \return フィッティングの最大繰り返し数
+ */
int fitMaxIter() const;
QString command() const;
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
if (smooth_ >= 0) {
str += "smooth " + SMOOTH[smooth_];
}
+ if (!str.isEmpty()) {
+ str += ' ';
+ }
return str;
}
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
}
str += ']';
}
+ if (!str.isEmpty()) {
+ str += ' ';
+ }
return str;
}
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007, 2008 Muneyuki Noguchi
+ * Copyright (C) 2007, 2008, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*!
* \brief Plot クラスのオブジェクトのリストを設定する
- * \param plot 設定するオブジェクト
+ * \param list 設定するオブジェクト
*/
void setPlot(const QList<Plot> &list);
/*!
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
public:
Angles();
+ /*!
+ * \brief 角度の単位を度にするかどうかを設定する
+ * \param degrees 角度の単位を度にするかどうか
+ */
void setDegrees(bool degrees);
+ /*!
+ * \brief 角度の単位を度にするかどうかを得る
+ * \return 角度の単位が度ならば true
+ */
bool isDegrees() const;
QString command() const;
+add_subdirectory(command)
add_subdirectory(opt)
--- /dev/null
+include(${QT_USE_FILE})
+include_directories(../../src/command)
+
+set(test_file_list FitTest.cpp)
+create_test_sourcelist(command_tests CommandTests.cpp ${test_file_list})
+
+set(command_file_list
+ ../../src/command/Fit.cpp
+ ../../src/command/FitModifier.cpp
+ ../../src/command/FitRange.cpp
+ ../../src/command/Plot.cpp
+ ../../src/command/PlotModifier.cpp
+ ../../src/command/PlotRange.cpp
+ ../../src/command/PlotStyle.cpp
+ ../../src/command/PlotTitle.cpp
+)
+add_executable(CommandTests ${command_tests} ${command_file_list})
+target_link_libraries(CommandTests ${QT_LIBRARIES})
+
+foreach (test_file ${test_file_list})
+ get_filename_component(filename ${test_file} NAME_WE)
+ add_test(${filename} CommandTests ${filename})
+endforeach (test_file)
--- /dev/null
+/*
+ * Cueplot: a GUI front-end to gnuplot
+ * Copyright (C) 2009 Muneyuki Noguchi
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "Fit.h"
+#include <QtCore/QString>
+#include <cstdlib> // exit()
+
+static void test_init(Fit &fit)
+{
+ if (fit.functionName() != "f(x)") {
+ exit(1);
+ }
+ if (!fit.isParameterFile()) {
+ exit(2);
+ }
+ fit.setFunction("ax+b");
+ fit.setDataFile("foo");
+ fit.setParameterFile(QString("bar"));
+ if (fit.command() != "f(x)=ax+b\nfit f(x) 'foo' via 'bar'") {
+ exit(3);
+ }
+}
+
+static void test_variable(Fit &fit)
+{
+ QStringList list;
+ list << "a" << "b";
+ fit.setVariable(list);
+ fit.setParameterFile(false);
+ if (fit.isParameterFile()) {
+ exit(4);
+ }
+ if (fit.command() != "f(x)=ax+b\nfit f(x) 'foo' via a,b") {
+ exit(5);
+ }
+}
+
+static void test_function_name(Fit &fit)
+{
+ fit.setFunctionName("g(x)");
+ if (fit.functionName() != "g(x)") {
+ exit(6);
+ }
+ if (fit.command() != "g(x)=ax+b\nfit g(x) 'foo' via a,b") {
+ exit(7);
+ }
+}
+
+int FitTest(int, char *[])
+{
+ Fit fit;
+ test_init(fit);
+ test_variable(fit);
+ test_function_name(fit);
+ return 0;
+}