2023-09-20 15:17:13 +00:00
|
|
|
#include "fun.hpp"
|
|
|
|
|
|
|
|
namespace fkstd
|
|
|
|
{
|
2023-09-20 19:21:51 +00:00
|
|
|
STDRET assert_eq(STDARGS args)
|
|
|
|
{
|
|
|
|
auto oracle = args[0];
|
|
|
|
auto expr = args[1];
|
|
|
|
|
|
|
|
if (!oracle->equals(*expr))
|
|
|
|
{
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << "assertion failed: expected '"
|
|
|
|
<< oracle->string()
|
|
|
|
<< "', got '"
|
|
|
|
<< expr->string()
|
|
|
|
<< "'";
|
|
|
|
|
|
|
|
oracle->loc().error<assert_error>(LOG_ERROR, ss.str());
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::make_shared<Constant>(TYPE_BOOL, true, oracle->loc());
|
|
|
|
}
|
|
|
|
|
2023-09-20 15:17:13 +00:00
|
|
|
STDRET println(STDARGS args)
|
|
|
|
{
|
|
|
|
std::string sep;
|
|
|
|
|
|
|
|
for (auto arg: args)
|
|
|
|
{
|
|
|
|
std::cout << sep << arg->string();
|
|
|
|
sep = " ";
|
|
|
|
}
|
|
|
|
|
|
|
|
Loc loc {"???"};
|
|
|
|
|
|
|
|
if (args.size() > 0)
|
|
|
|
{
|
|
|
|
loc = args.front()->loc();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
|
|
|
return std::make_shared<Constant>(TYPE_INT, 0, loc);
|
|
|
|
}
|
|
|
|
}
|