Beispiel #1
0
    void PropertyTest::testCanCreatePropertiesOfDifferentTypes()
    {
        string name1("prop1");
        string name2("prop2");
        string name3("prop3");
        string name4("prop4");
        string name5("prop5");
        
        bool ok = true;
        string someValue("name");
        int integer = 34;
        double d = 45.24;
        DateTime now;

        Property<string, bool> prop1(name1, ok);
        CPPUNIT_ASSERT_EQUAL(ok, prop1());
        CPPUNIT_ASSERT_EQUAL(ok, prop1.getValue());
        CPPUNIT_ASSERT_EQUAL(name1, prop1.getName());

        Property<string, string> prop2(name2, someValue);
        CPPUNIT_ASSERT_EQUAL(someValue, prop2());
        CPPUNIT_ASSERT_EQUAL(someValue, prop2.getValue());
        CPPUNIT_ASSERT_EQUAL(name2, prop2.getName());

        Property<string, int> prop3(name3, integer);
        CPPUNIT_ASSERT_EQUAL(integer, prop3());
        CPPUNIT_ASSERT_EQUAL(integer, prop3.getValue());
        CPPUNIT_ASSERT_EQUAL(name3, prop3.getName());

        Property<string, double> prop4(name4, d);
        CPPUNIT_ASSERT_EQUAL(d, prop4());
        CPPUNIT_ASSERT_EQUAL(d, prop4.getValue());
        CPPUNIT_ASSERT_EQUAL(name4, prop4.getName());
        
        Property<string, DateTime> prop5(name5, now);
        CPPUNIT_ASSERT_EQUAL(now.utcTime(), prop5().utcTime());
        CPPUNIT_ASSERT_EQUAL(now.utcTime(), prop5.getValue().utcTime());
        CPPUNIT_ASSERT_EQUAL(name5, prop5.getName());
    }
Beispiel #2
0
int main() {

	Room* B111 = new Room("B111");
	Time atime;
	atime.d_year = 2015;
	atime.d_month = 9; 
	atime.d_day = 14;
	atime.d_hour = 4; 
	atime.d_minutes = 10;
	const char *names[] = { "Rodger", "Kate", "Willie", "Ben", "Brian" };
	vector<string> name1(names, end(names));
	vector<string> name2(names, end(names));
	vector<string> name3(names, end(names));
	vector<string> name4(names, end(names));
	vector<string> name5(names, end(names));
 	B111->add(new Meeting(true, name1, "Assignment1", atime, 56, 5));
	B111->print();
	B111->add(new Meeting(true, name2, "Midtern" , atime, 66, 0));
	B111->print();
	B111->add(new Meeting(true, name3, "FinalExam ", atime, 67, 7));
	B111->print();
	B111->add(new Meeting(true, name4, "Faculty Meeting", atime, 69, 3));
	B111->print();
	B111->add(new Meeting(true, name5, "TA Meeting ", atime, 70, 0));
	B111->print();
	Room* A111 = new Room("A111");
	B111 = new Room(*A111);
	B111->setName("B111");
	Meeting* getTogether = new Meeting(true, name2, "Assigment2", atime, 34, 0); 
	B111->add(getTogether); 
	B111->print(); 
	A111->print();
	delete A111; 
	B111->print();
	delete B111; 

	system("pause");
}
Beispiel #3
0
int
trans(int c, char *p1)
{
	int f;
	f = ROM;
	switch (c) {
	case '0': case '1': case '2': case '3': case '4':
	case '5': case '6': case '7': case '8': case '9':
	case ':': case ';': case '!': case '%':
	case '(': case '[': case ')': case ']':
	case ',':
		if (rf == ITAL)
			shim();
		roman(c); break;
	case '.':
		if (rf == ROM)
			roman(c);
		else
			cs[csp++] = c;
		f = rf;
		break;
	case '|':
		if (rf == ITAL)
			shim();
		shim(); roman(c); shim(); break;
	case '=':
		if (rf == ITAL)
			shim();
		name4('e', 'q');
		break;
	case '+':
		if (rf == ITAL)
			shim();
		name4('p', 'l');
		break;
	case '>': case '<':
		if (rf == ITAL)
			shim();
		if (p1[psp] == '=') {	/* look ahead for == <= >= */
			name4(c, '=');
			psp++;
		} else {
			cs[csp++] = c;
		}
		break;
	case '-':
		if (rf == ITAL)
			shim();
		if (p1[psp] == '>') {
			name4('-', '>'); psp++;
		} else {
			name4('m', 'i');
		}
		break;
	case '/':
		if (rf == ITAL)
			shim();
		name4('s', 'l');
		break;
	case '~': case ' ':
		shim(); shim(); break;
	case '^':
		shim(); break;
	case '\\':	/* troff - pass 2 or 3 more chars */
		if (rf == ITAL)
			shim();
		cs[csp++] = c; cs[csp++] = c = p1[psp++]; cs[csp++] = p1[psp++];
		if (c == '(') cs[csp++] = p1[psp++];
		if (c == '*' && cs[csp-1] == '(') {
			cs[csp++] = p1[psp++];
			cs[csp++] = p1[psp++];
		}
		break;
	case '\'':
		cs[csp++] = '\\';
		cs[csp++] = 'f';
		cs[csp++] = rf == ITAL ? ITAL : ROM;
		name4('f', 'm');
		cs[csp++] = '\\'; cs[csp++] = 'f'; cs[csp++] = 'P';
		f = rf == ITAL ? ITAL : ROM;
		break;

	case 'f':
		if (ft == ITAL) {
			cs[csp++] = '\\'; cs[csp++] = '^';
			cs[csp++] = 'f';

			/* trying | instead of ^ */
			cs[csp++] = '\\'; cs[csp++] = '|';

			f = ITAL;
		}
		else
			cs[csp++] = 'f';
		break;
	case 'j':
		if (ft == ITAL) {
			cs[csp++] = '\\'; cs[csp++] = '^';
			cs[csp++] = 'j';
			f = ITAL;
		}
		else
			cs[csp++] = 'j';
		break;
	default:
		cs[csp++] = c;
		f = ft == ITAL ? ITAL : ROM;
		break;
	}
	return (f);
}