Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

guid_test.dart 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2017, Paul DeMarco.
  2. // All rights reserved. Use of this source code is governed by a
  3. // BSD-style license that can be found in the LICENSE file.
  4. import 'package:flutter_blue/flutter_blue.dart';
  5. import 'package:flutter_test/flutter_test.dart';
  6. main() {
  7. group("Guid", () {
  8. test('equality', () {
  9. var guid = new Guid("{00002a43-0000-1000-8000-00805f9b34fb}");
  10. var guid2 = new Guid("00002a43-0000-1000-8000-00805f9b34fb");
  11. expect(guid, guid2);
  12. var mac = new Guid.fromMac("01:02:03:04:05:06");
  13. var mac2 = new Guid.fromMac("01:02:03:04:05:06");
  14. expect(mac, mac2);
  15. });
  16. test('empty()', () {
  17. var guid = new Guid.empty();
  18. expect("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
  19. guid.toByteArray().toString());
  20. });
  21. test('toByteArray()', () {
  22. var guid = new Guid("{00002a43-0000-1000-8000-00805f9b34fb}");
  23. expect("[0, 0, 42, 67, 0, 0, 16, 0, 128, 0, 0, 128, 95, 155, 52, 251]",
  24. guid.toByteArray().toString());
  25. });
  26. test('toString()', () {
  27. var guid = new Guid("{00002a43-0000-1000-8000-00805f9b34fb}");
  28. expect("00002a43-0000-1000-8000-00805f9b34fb", guid.toString());
  29. });
  30. test('fromMac()', () {
  31. var guid = new Guid.fromMac("24:0A:64:50:A4:67");
  32. expect("[36, 10, 100, 80, 164, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
  33. guid.toByteArray().toString());
  34. });
  35. test('fromMac()', () {
  36. var guid = new Guid.fromMac("24:0A:64:50:A4:67");
  37. expect("24:0A:64:50:A4:67", guid.toMac());
  38. });
  39. test('hashCode', () {
  40. var guid = new Guid.fromMac("24:0A:64:50:A4:67");
  41. var guid2 = new Guid.fromMac("24:0A:64:50:A4:67");
  42. expect(guid.hashCode, guid2.hashCode);
  43. });
  44. test('empty() equality', () {
  45. var guid = new Guid.empty();
  46. var guid2 = new Guid.empty();
  47. var guid3 = new Guid.fromMac("24:0A:64:50:A4:67");
  48. expect(guid == guid2, true);
  49. expect(guid == guid3, false);
  50. });
  51. });
  52. }