Exemplo n.º 1
0
TEST_F(ArduinoStringTests, JsonObject_SetKeyValue) {
  JsonObject &object = _jsonBuffer.createObject();
  String key("hello");
  String value("world");
  object.set(key, value);
  eraseString(key);
  eraseString(value);
  ASSERT_STREQ("world", object["hello"]);
}
Exemplo n.º 2
0
TEST_F(ArduinoStringTests, JsonBuffer_ParseObject) {
  String json("{\"hello\":\"world\"}");
  JsonObject &object = _jsonBuffer.parseObject(json);
  eraseString(json);
  ASSERT_TRUE(object.success());
  ASSERT_STREQ("world", object["hello"]);
}
Exemplo n.º 3
0
TEST_F(ArduinoStringTests, JsonBuffer_ParseArray) {
  String json("[\"hello\"]");
  JsonArray &array = _jsonBuffer.parseArray(json);
  eraseString(json);
  ASSERT_TRUE(array.success());
  ASSERT_STREQ("hello", array[0]);
}
Exemplo n.º 4
0
TEST_F(ArduinoStringTests, JsonArray_Add) {
  JsonArray &array = _jsonBuffer.createArray();
  String value("hello");
  array.add(value);
  eraseString(value);
  ASSERT_STREQ("hello", array[0]);
}
Exemplo n.º 5
0
TEST_F(ArduinoStringTests, JsonObjectSubscript_SetValue) {
  JsonObject &object = _jsonBuffer.createObject();
  String value("world");
  object["hello"] = value;
  eraseString(value);
  ASSERT_STREQ("world", object["hello"]);
}
Exemplo n.º 6
0
TEST_F(ArduinoStringTests, JsonObjectSubscript_SetKey) {
  JsonObject &object = _jsonBuffer.createObject();
  String key("hello");
  object[key] = "world";
  eraseString(key);
  ASSERT_STREQ("world", object["hello"]);
}
Exemplo n.º 7
0
TEST_F(ArduinoStringTests, JsonArraySubscript) {
  JsonArray &array = _jsonBuffer.createArray();
  String value("world");
  array.add("hello");
  array[0] = value;
  eraseString(value);
  ASSERT_STREQ("world", array[0]);
}
Exemplo n.º 8
0
TEST_F(ArduinoStringTests, JsonObject_CreateNestedObject) {
  String key = "key";
  char json[64];
  JsonObject &object = _jsonBuffer.createObject();
  object.createNestedObject(key);
  eraseString(key);
  object.printTo(json, sizeof(json));
  ASSERT_STREQ("{\"key\":{}}", json);
}
int main()
{
	int gDriver=DETECT,gMode=0,i;
	initgraph(&gDriver,&gMode,"C:\\TC\\BGI");

	float rad=0.01;
	int string_bottom_x,string_bottom_y;
	int ball_x,ball_y,sign=1;

	background();
	drawString(320,300);
	eraseString(320,300);
	//drawBall(320,320);

	for(rad=0.01;rad<T;rad+=(sign*0.01))
	{	string_bottom_y=cos(rad)*L;
		string_bottom_x=sin(rad)*L;
		ball_y=cos(rad)*(L+20);
		ball_x=sin(rad)*(L+20);
		//cout<<"("<<ball_x<<"|"<<ball_y<<")";
		drawString(320-string_bottom_x,100+string_bottom_y);
		drawBall(320-ball_x,100+ball_y);
		delay(60);
		eraseString(320-string_bottom_x,100+string_bottom_y);
		eraseBall(320-ball_x,100+ball_y);
		if(ball_y==190&&ball_x==109)
		{	sign=-1;
		}
		if(ball_y==190&&ball_x==-109)
		{	sign=1;
			//getch();
		}
	}


	getch();
	return 0;
}