Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(60)

Issue 2947: Adding example of using Google Test with a Framework on Xcode

Can't Edit
Can't Publish+Mail
Start Review
Created:
17 years, 5 months ago by Preston
Modified:
11 years, 1 month ago
Reviewers:
wan
CC:
googletestframework_googlegroups.com
Base URL:
http://googletest.googlecode.com/svn/trunk/
Visibility:
Public.

Patch Set 1 #

Patch Set 2 : Just a simple modification to the Info.plist #

Patch Set 3 : Converted FrameworkSample to Google Style guidelines, also fixed a buffer overflow. #

Patch Set 4 : Simplified the test code to remove intermediate values" #

Unified diffs Side-by-side diffs Delta from patch set Stats (+553 lines, -0 lines) Patch
Samples/FrameworkSample/Info.plist View 1 chunk +28 lines, -0 lines 0 comments Download
Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj View 1 chunk +335 lines, -0 lines 0 comments Download
Samples/FrameworkSample/widget.h View 1 chunk +59 lines, -0 lines 0 comments Download
Samples/FrameworkSample/widget.cc View 1 chunk +63 lines, -0 lines 0 comments Download
Samples/FrameworkSample/widget_test.cc View 3 1 chunk +68 lines, -0 lines 0 comments Download

Messages

Total messages: 3
Preston
I'm adding an example for using Google Test with a Framework in Xcode. Please let ...
17 years, 5 months ago (2008-08-16 03:28:19 UTC) #1
Zhanyong
http://codereview.appspot.com/2947/diff/22/14 File xcode/Samples/FrameworkSample/Info.plist (right): http://codereview.appspot.com/2947/diff/22/14#newcode20 Line 20: <string>1.01</string> Do we need to manually update this ...
17 years, 4 months ago (2008-08-18 21:32:31 UTC) #2
Preston
17 years, 4 months ago (2008-08-19 12:38:12 UTC) #3
Zhanyong,

I converted the files to Google Style (and fixed a buffer overflow) can you take
a look at the new version.

Thanks,
Preston

http://codereview.appspot.com/2947/diff/22/14
File xcode/Samples/FrameworkSample/Info.plist (right):

http://codereview.appspot.com/2947/diff/22/14#newcode20
Line 20: <string>1.01</string>
Nope. This is just a dummy value of the version of the WidgetFramework, not
Google Test.

On 2008/08/18 21:32:31, Zhanyong wrote:
> Do we need to manually update this with each point release?  That doesn't
scale.

http://codereview.appspot.com/2947/diff/22/13
File xcode/Samples/FrameworkSample/Widget.cpp (right):

http://codereview.appspot.com/2947/diff/22/13#newcode33
Line 33: // Widget.cpp
On 2008/08/18 21:32:31, Zhanyong wrote:
> gtest uses the .cc extension for C++ code.  Can we be consistent here?

Done.

http://codereview.appspot.com/2947/diff/22/15
File xcode/Samples/FrameworkSample/Widget.h (right):

http://codereview.appspot.com/2947/diff/22/15#newcode45
Line 45: Widget(int number, std::string name);
On 2008/08/18 21:32:31, Zhanyong wrote:
> Change the second argument to pass-by-reference?

Done.

http://codereview.appspot.com/2947/diff/22/15#newcode49
Line 49: float floatValue();
On 2008/08/18 21:32:31, Zhanyong wrote:
> Style: GetFloatValue().
> 
> The same for other members.

Done.

http://codereview.appspot.com/2947/diff/22/15#newcode58
Line 58: float _number;
On 2008/08/18 21:32:31, Zhanyong wrote:
> Style: number_

Done.

http://codereview.appspot.com/2947/diff/22/15#newcode59
Line 59: std::string _name;
On 2008/08/18 21:32:31, Zhanyong wrote:
> Style: name_

Done.

http://codereview.appspot.com/2947/diff/22/12
File xcode/Samples/FrameworkSample/Widget_test.cpp (right):

http://codereview.appspot.com/2947/diff/22/12#newcode33
Line 33: // Widget_test.cpp
On 2008/08/18 21:32:31, Zhanyong wrote:
> .cc?

Done.

http://codereview.appspot.com/2947/diff/22/12#newcode40
Line 40: // This test verifies that the constructor sets the internal state of
the
On 2008/08/18 21:32:31, Zhanyong wrote:
> Style: add a blank line before this.

Done.

http://codereview.appspot.com/2947/diff/22/12#newcode47
Line 47: EXPECT_EQ(widget.floatValue(), value);
On 2008/08/18 21:32:31, Zhanyong wrote:
> The first argument to EXPECT_EQ() is the expected value.  Therefore you should
> switch the two arguments.
> 
> The behavior of comparing two floating-point values directly is not well
> defined.  Therefore use EXPECT_FLOAT_EQ instead.
> 
> I'd get rid of the intermediate variables as they actually make the test
harder
> to follow.  Just:
> 
>   Widget widget(1.0f, "name");
>   EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue());
>   EXPECT_EQ("name", widget.GetStringValue());
> 
> The same for the next test.

Done.

http://codereview.appspot.com/2947/diff/22/12#newcode63
Line 63: int main(int argc, char **argv) {
On 2008/08/18 21:32:31, Zhanyong wrote:
> We want to promote gtest_main.  Can we instead make the test link with
> gtest_main?

Done.

http://codereview.appspot.com/2947/diff/22/11
File xcode/gtest.xcodeproj/project.pbxproj (right):

http://codereview.appspot.com/2947/diff/22/11#newcode101
Line 101: remoteGlobalIDString = 40C44ADC0E3798F4008FCC51;
No, it was a mistake. Reverted.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b