From 2de3693dd24463c5a02b9308ddfd674f58bac7c1 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 10 Jul 2007 00:19:19 +0000 Subject: Fixed the atom, it wasn't copying from other atoms properly. --- src/tests/fstratsptr.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/tests/fstratsptr.cpp (limited to 'src/tests') diff --git a/src/tests/fstratsptr.cpp b/src/tests/fstratsptr.cpp new file mode 100644 index 0000000..343f682 --- /dev/null +++ b/src/tests/fstratsptr.cpp @@ -0,0 +1,46 @@ +#include "bu/fstring.h" +#include "bu/atom.h" +#include "bu/sptr.h" + +class Person +{ +public: + Person(){}; + virtual ~Person(){}; + + Bu::Atom sFirstName; + Bu::Atom sLastName; +}; + +typedef Bu::SPtr PersonPtr; + +void Swap(PersonPtr one, PersonPtr two) +{ + PersonPtr three(new Person); + three->sFirstName = one->sFirstName; + three->sLastName = two->sLastName; + + printf( + "%s %s\n", + three->sFirstName->c_str(), + three->sLastName->c_str() ); +} + +int main() +{ +/* PersonPtr one(new Person); + PersonPtr two(new Person); + one->sFirstName = "Bob"; + one->sLastName = "Smith"; + two->sFirstName = "Fred"; + two->sLastName = "Carpenter"; + + Swap(one, two); +*/ + + Bu::Atom sOne, sTwo; + sOne = "Hello"; + sTwo = sOne; + + return 0; +} -- cgit v1.2.3