Writing test cases for iOS 4 accelerometer/gyroscope data collection
I'm developing an app for iPhone (iOS 4.2) which needs to be able to collect large amounts of data from the accelerometer and gyroscope. I'm current looking at using the CoreMotion framework to get the data into an acceptor class (from which I'm writing it to a database).
However, for code quality I want to write some test cases to test my acceptor class. Through research there doesn't seem to be any clear way to do this - CoreMotion just outputs data as floats, but I don't just want to feed a load of floats into the acceptor class, because that won't replicate how CoreMotion behaves - rather just how a feed of floats will.
Is it fair to assume that as CoreMotion is an apple-produced class when "they" say it will produce data at x-hertz, and this data will be between the range of y an开发者_开发问答d z that this is a given?
Any ideas/hints relating to writing and developing test cases, and additionally relating to my overall design would be greatly appreciated.
Download the core motion teapot sample on the developer website. You'll be able to set the rate (hertz) of returned data per second. You can also request timestamp from core motion to get the exact time of the accelerometer / gyroscope data.
The accelerometer isn't accurate. You can use it to get a general idea of current acceleration which is useful for detecting direction of movement but not for getting distances or velocity.
精彩评论